Posts

Showing posts with the label asp.net-mvc-4

When clicking on an controller of ASP.NET MVC area it is appending the {area}/{controller} to the {area} again

Image
Clash Royale CLAN TAG #URR8PPP When clicking on an controller of ASP.NET MVC area it is appending the {area}/{controller} to the {area} again Area Structure Area Admin Section Part etc. Here is my Area routing public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Admin_default", "Admin/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional } ); } When clicking on Section it is routing correctly http://localhost:50007/Admin/Section Now on the same page if I route to Part the url is like below http://localhost:50007/Admin/Admin/Part By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

@Html.ValidationMessageFor() required field displaying message when populated

Image
Clash Royale CLAN TAG #URR8PPP @Html.ValidationMessageFor() required field displaying message when populated I am currently using ASP.net MVC (VB). I have a model with the following property: <Required(ErrorMessage:="Contact name is required")> Public Property contact_name() As String <Required(ErrorMessage:="Contact name is required")> Public Property contact_name() As String In my controller method (accepts a post request and binds various parameters to the model) I set contact_name from two other parameters : model.contact_name = first_name + " " + last_name model.contact_name = first_name + " " + last_name I return to my view containing a form which has an input field with a value of model.contact_name and I use the tag model.contact_name @Html.ValidationMessageFor(Function(model) model.contact_name @Html.ValidationMessageFor(Function(model) model.contact_name The problem is that the error message is always displayed, unles...