in views instead of using
<%=Html.TextBox("username", Model.UserName)%>
you can use
<%= Html.TextBoxFor( m => m.UserName)%>
in controller:
public ActionResult LogOn(string userName, string password)
use
public ActionResult LogOn(LoginViewModel loginviewModel)
moreover you dont need to use ValueProvider["UserName"].AttemptedValue to access Html value and you can use model directly.
and for adding attribute
<%= Html.TextBoxFor(model => model.UserName , new { @calss="SingleTextBox" }) %>
No comments:
Post a Comment