I have an ASP.NET MVC 2 website in which I would like to place the input controls on the main page. I want any validation error messages to be displayed on the main page. How can I do it? If I do something like this:
<% using (Html.BeginForm("LogOn", "Account", FormMethod.Post)) { %>
<%= Html.LabelFor(d => d.UserName)%>:
<%= Html.EditorFor(d => d.UserName)%>
<%= Html.LabelFor(d => d.Password)%>:
<%= Html.Password("Password")%>
<input type="submit" value="Login" />
<%= Html.ValidationSummary() %>
<% } %>
... the account controller method is simply called a fine. However, when I return View()from the method, I get an error message that does not have a view called LogOn. How to achieve the expected result.
source
share