I have an editor template whose job is to take a SelectList as its model and build a select element in html using the Html.DropDownList() helper extension.
I'm trying to assign the name attribute for the select based on a ModelMetadata property. (Reason: on post-back, I need to bind to an object that has a different property name for th...
I am using MVC 2, and having a slight issue with the ActionLink not going to the correct controller
The following line of code, which displays a logoff link
<%= Html.ActionLink("Log Off", "LogOff", "Account", new { @class = "loginStatus" })%>
It does not appear to be going to the Account controller
The link it is make is:
http://lo...
I'm using linq to SQL and MVC2 with data annotations and I'm having some problems on validation of some types.
For example:
[DisplayName("Geplande sessies")]
[PositiefGeheelGetal(ErrorMessage = "Ongeldige ingave. Positief geheel getal verwacht")]
public string Proj_GeplandeSessies { get; set; }
This is an integer, and I'm validating ...
I have been working with MVC 2 and it seems that at some point of time the ModelBindingContext.ValueProvider class has been removed and replace with IValueProvider. Because of this im having trouble iterating through the ValueProvider.Keys. Here is an example and the message I receive from Code complete
private void foo(ModelBindingCon...
How do you put views and content in a separate assembly that can be referenced from a MvcApplication?
...
I get a 404 error when I navigate to the following URL using the route below:
http://localhost:53999/properties/
However, all the following are correctly routed to the List action in my controller:
http://localhost:53999/properties/usa/new-york/manhattan/12
http://localhost:53999/properties/usa/new-york/manhattan
http://localhost:53...
I have this sole route in my app:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = ""}
);
This works great for URLs like:
/Blah/Index
/Blah/Create
/Blah/Details/5
I want to add text to that last one like SO does:
...
I opened a solution in Visual Studio 2010 RC that I previously created using Visual Studio 2008 and ASP.NET MVC 2.0 RC using the 3.5 framework. When I tested it I received a 404 error. I tried adding the default page as described in this post but got an invalid route error.
Anyone else ran into this?
...
It seems like it's not possible to edit custom object anymore after I upgraded to asp.net mvc 2 rc 2? I use this approach http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-4-custom-object-templates.html with a custom object like this:
My model has just one property but inherits from an abstract base class
public cl...
Hello,
for one of my customer's I implemented a site that displays a questionaire. The questions are pulled via JSONP from an MVC application running on a remote site.
In order to recognize the user I use the session. However, as the session id is not guaranteed to be the same on each request I store my own session Id in a session va...
I'm getting totally lost and confused on how to use the new strongly typed Html.DropDownListFor helper on ASP.NET MVC 2.0 R2
In the View I'm writting:
<%= Html.DropDownListFor(m => m.ParentCategory, new SelectList(Model.Categories, "CategoryId", "Name", Model.ParentCategory), "[ None ]")%>
<%= Html.ValidationMessageFor(m => m.ParentCa...
Hi,
The class that's returned to the view has several enum values from other tables:
class Person{
int id;
enum Rank;
enum Status;
}
In the 'edit' View I would like to have a select box with the selected value
so the user is able to change to another enum value.
I get the enum values into a ViewData:
<%= Html.DropDownList("Rank")%...
In the MVC RC 2 docs, we find:
Expression-based helpers that render input elements generate correct name attributes when the expression contains an array or collection index. For example, the value of the name attribute rendered by Html.EditorFor(m => m.Orders[i]) for the first order in a list would be Orders[0].
Anyone care to lin...
I am new to asp.net mvc in general and have yet to build a fully functional application. The main reason for this is I couldn't get my head around building administration areas.
I am now looking at MVC2 and have noticed this new feature called areas, I have created a sample application with an area called Announcements (essentially a bl...
I'm using MVC 2, and the Html.EditorForModel() to allow me to display an editor for the model.
I am using a model which looks something like this:
public class LoanACar
{
[DisplayNameFromResource("VehicleDetails")]
public string VehicleDetails { get; set; }
[DisplayNameFromResource("VehicleId")]
[Required]
public lo...
Are there any performance issues with registering a number of routes with the routing engine in ASP.NET MVC 2? What I am planning on doing is registered one route per page for content pages that are not categories. In other words, for pages like this there would be one route registered for each one:
/Home/About
/Home/Contact
/Home/Dire...
If you do this in Asp.Net MVC 2 RC 2:
<% for (int count = 0; count < Model.Students.Count; count++ )
{ %><%=
Html.EditorFor(m => m.Students[count]) %><%
}
%>
where Students is a List<Student>, and it produces this:
<input class="text-box single-line" id="Students_0__Name...
I have a basic MVC 2 (RC2) site with one base-level controller ("Home"), and one area ("Admin") with one controller ("Abstract"). When i call http://website/Abstract - the Abstract controller in the Admin area gets called even though i haven't specified the Area in the URL. To make matters worse - it doesn't seem to know it's under Admin...
In global.asax
routes.MapRoute(
"Test_Default", // Route name
"test/{controller}/{action}", // URL with parameters
new { }
);
routes.MapRoute(
"Default",
"{universe}",
new { controller = "notfound", action = "error"}
);
I have a c...
I have an Asp.net MVC2 web application. I built the application using VS2008 and tested on internal server, everything was perfect but when i deployed that web application on a local IIS the paths to images in web pages and in css file was not correct.
I need to change those paths for working with internal server and local server.
How c...