Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <% Html.EnableClientValidation(); %>
- <%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %>
- <% using(Html.BeginForm("HandleForm", "Home")) {%>
- <div class="editor-label">Username:</div>
- <div class="editor-field">
- <%: Html.TextBoxFor(m => m.UserName) %>
- <%: Html.ValidationMessageFor(m => m.UserName) %>
- </div>
- <div class="editor-label">Password:</div>
- <div class="editor-field">
- <%: Html.PasswordFor(m => m.Password) %>
- <%: Html.ValidationMessageFor(m => m.Password) %>
- </div>
- <p>
- <input type="submit" value="Login" />
- </p>
- <%-- <a id="LoginButton" href="#Reports">Login</a>--%>
- <% } %>
- /////////////Controller
- [HttpPost]
- public ActionResult HandleForm(string Username, string Password)
- {
- if (!ModelState.IsValid)
- return View("Index");
- return RedirectToAction("Index");
- }
- [HttpPost]
- public ActionResult HandleForm(LogOnModel model)
- {
- if (!ModelState.IsValid)
- return View("Index");
- return RedirectToAction("Index");
- }
Add Comment
Please, Sign In to add comment