When I click run on my vs2008 to try out a page it tries to load
http://localhost:14092/Views/Employee/Index.aspx
which should be
http://localhost:14092/Employee/Index
or http://localhost:14092/
How do I add these 2 routes? (I want to know how to do both so I can swap them as desired.
Here's my current routing code:
public stati...
This likely applies to non MVC too. But, Is it possible to use the 'using' statement in my aspx views?
Reason is that I have the pages reference resource files for localised strings. And some of these resource references are quite long - it's really cluttering my code.
Since most of the time these resources are in a namespace specifi...
Hi
I am wondering is there a way to render a partial view in the controller. So like you have a partial view and instead of returning it you render it right there in that controller method and store the result into a string or something like that?
...
Hi , i am a newbie on web development, so i have some problems first of all what is the meaning of ~, / on an url? My real question in my javascript code i am doing some ajax calls with jquery like that
$.ajax({
...
url: '/Membership/Login',
...
});
There is an Membership controller with an Login action method that i need to s...
I have a simple ASP.NET MVC + OpenID + NHibernate app (on top of MSSQL Server DB). The app is strictly single tenant and supports multiple users with only 2 roles (Admin and User).
I would like to convert this app into a multi-tenant app. My requirements are limited: I just need to introduce the notion of Accounts, each account having i...
Hi
I had to change on my lines of code around. I before had something like this
// this is in a static method.
List<string> mySTring = new List<string>();
mySTring.add("one");
mySTring.add("two");
However on one of my pages I have a dropdownlist that does not require the field "two" so instead of writing duplicate code all I did was...
Hi
I have this code
List<SelectListItem> list = new List<SelectListItem>()
{
new SelectListItem() { Text = "bob", Value = "bob"},
new SelectListItem() { Text = "apple", Value = "apple"},
new SelectListItem() { Text = "grapes", Value = "grapes"},
};
This will be used for binding with the asp.net mv...
I have the following code:
[AcceptVerbs(HttpVerbs.Post), Authorize(Roles = RoleKeys.Administrators)]
public ActionResult Edit(int id, FormCollection collection)
{
User user = userRepository.GetUser(id);
try
{
this.UpdateModel(user);
userRepository.Save();
return ...
Hi,
I'd like to know the best way of converting a list of domain object I retrieve into custom ViewModels in the controller
e.g.
IList<Balls> _balls = _ballsService.GetBalls(searchCriteria);
into
IList<BallViewModels> _balls = _ballsService.GetBalls(searchCriteria);
it doesn't have to be exactly as I've outlined above i.e. it do...
I have a very strange issue on my hands.
I have two IIS websites using host headers.
I have some simple code using JQuery and JQuery.forms to post a simple form to a controller. The controller returns JSON. It works great as long as the client code is present on the web site that has the controller code.
The moment I move the form...
I have a new solution that is an ASP.NET MVC 2.0 application. I have added a porject to the solution which is a console application. The console namespace is foo, and it has a data repository called FooDataRepository which is a public class. I also have a public class in the foo namespace called FooLinkList, which is also public.
In ...
Hi there
I'm using Entity Framework in my project, and I have the problem that, once I pass my entities to a View (keep in mind that these entities have lazy-initialized objects along the lines of: Products.Owner, where owner is an object that is lazily initialized) I get a run-time exception telling me that the ObjectContext is out of ...
Hi
I have site that users lots of ajax(jquery). Now if the user times out for whatever reason(walked about for 30mins or something). On there next action I want them to be returned to the login page.
I setup everything in the webconfig(returnUrl and timeout) and if they try to go to a page they have no premission to go to they get sent...
I am trying out the Spark view engine with ASP MVC but get the error below when displaying a view. The view references model objects that are in a different assembly to the main web application (MyApp.Model.dll). I am stuck on the cause or resolution to this.
Dynamic view compilation failed.
0,0): error CS1704: An assembly with the sam...
I installed Visual Web Developer 2008 Express SP1 and then ASP.NET MVC 1.0, but when I go to File > New Website, ASP.NET MVC doesn't show up.
...
I know how to create a url by using html.actionlink in the aspx file. But if I want to create the same url in a code behind file how would I do that?
...
I have this code in jquery to prevent non-numeric characters being inputted to the text field
$("#NumericField").numeric();
Now, on the text field i cant input non-numeric characters. That is OK. The problem here is if the user will paste on the text field with non numeric characters.
Is there a way/method to disable pasting if the v...
I want my asp.net mvc(C#) application to be with the session without expire.
The Session should be active forever the user opens the application.
Whats the best way to do it?
...
Hi All,
I am newbie for ASP.NET MVC 1.0. I am converting from a classic application built up with VS2008 .NET3.5. I created a master page, and the menu must be read from the database. Now the code that generate the HTML into the appropriate menu div in classic ASP.NET3.5 VS2008 was in the code behind of the master page.
I cannot unders...
I would like to setup a multi-tenant ASP.NET MVC app. Ideally, this app would have a route with {tenant}/{controller}/{action}/{id}, each tenant representing an logical instance of the app (simply independent multi-user accounts)
The fine grained details how do that are still quite unclear to me. Any guide available to setup such multi-...