hi
my LogIn is partial view. i pass a model that contain some fields of tbl_profile to partial view and fill it and then i pass filled model to a action result in [HttpPost] part and ... but now i'm trouble in [HttpGet] part . i get this error on this line of cod:
@{ Html.RenderPartial("LogOn", "Account"); }
<pre lang="c#">
[HttpGet]
public ActionResult LogOn(string returnUrl)
{
using (var db = new MyContext())
{
var AllFeatureToLog = db.tbl_profile.Select(u => new UsersClass.LogOn { username = u.username, password_User = u.password_User });
return PartialView(AllFeatureToLog);
}
}
class :
public class UsersClass
{
public class LogOn
{
public string username { get; set; }
public string password_User { get; set; }
}
}
partial view(logon.cshtml):
@model MyProject.Models.UsersClass.LogOn
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<form class="signin-form">
@Html.TextBoxFor(m => m.username, new { @id = "username", @class = "input-block- level", @placeholder = "* enter username" })
@Html.TextBoxFor(m => m.password_User, new { @id = "password", @class = "input-block-level", @placeholder = "* enter pass" })
@Html.ValidationMessage("LoginError")
<label class="checkbox">
<input type="checkbox">remember me</label>
<button class="btn btn-medium btn-general input-block-level" type="submit"> enter</button>
</form>
}
error :
The model item passed into the dictionary is of type 'System.String', but this dictionary requires a model item of type 'MyProject.Models.UsersClass+LogOn'
when i use breakpoint on controller ([HttpGet]) it dose not go into it .and directly shows this error .