daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Oct 17th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <% Html.EnableClientValidation(); %>
  2. <%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %>
  3.  
  4. <% using(Html.BeginForm("HandleForm", "Home")) {%>
  5.         <div class="editor-label">Username:</div>
  6.         <div class="editor-field">
  7.             <%: Html.TextBoxFor(m => m.UserName) %>
  8.             <%: Html.ValidationMessageFor(m => m.UserName) %>
  9.         </div>
  10.                
  11.         <div class="editor-label">Password:</div>
  12.         <div class="editor-field">
  13.             <%: Html.PasswordFor(m => m.Password) %>
  14.             <%: Html.ValidationMessageFor(m => m.Password) %>
  15.         </div>
  16.         <p>
  17.              <input type="submit" value="Login" />
  18.         </p>
  19.  
  20. <%--        <a id="LoginButton"  href="#Reports">Login</a>--%>
  21.      <% } %>
  22.  
  23.  
  24.  
  25.  
  26.  
  27. /////////////Controller
  28.         [HttpPost]
  29.         public ActionResult HandleForm(string Username, string Password)
  30.         {
  31.             if (!ModelState.IsValid)
  32.                 return View("Index");
  33.             return RedirectToAction("Index");
  34.         }
  35.  
  36.         [HttpPost]
  37.         public ActionResult HandleForm(LogOnModel model)
  38.         {
  39.             if (!ModelState.IsValid)
  40.                 return View("Index");
  41.             return RedirectToAction("Index");
  42.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top