想要实现这个目标 请帮帮我?
但我收到此错误
The model item passed into the dictionary is of type 'demo4.Models.SignUp', but this dictionary requires a model item of type 'demo4.Models.Login'.
login Model
public class Login
{
[Required]
public string UserName { get; set; }
[Required]
public string Password { get; set; }
}
SignUp模型 公共登录_logindetails; [需要] public string FirstName {get;组; } [需要] public string LastName {get;组; } [需要] public string Email {get;组; } [需要] public string UserName {get;组; } [需要] public string密码{get;组; } SignUp控制器 公共ActionResult索引() { demo4.Models.SignUp obj = new Models.SignUp(); return View(obj); } 注册index.cs.html页面
@model demo4.Models.SignUp
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<script src="~/Scripts/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#testdivopen').toggle(
function () {
$('#PartialView').css("display", "block");
}
,
function () {
$('#PartialView').css("display", "block");
}
);
});
</script>
<h2>Index</h2>
<div><a id="testdivopen" href="#"></a></div>
<div id="PartialView">
@Html.Partial("_signin", Model._logindetails)
</div>
<div id="signupview" style="display: none;">
@Html.TextBoxFor(m => m.FirstName);
@Html.TextBoxFor(m => m.LastName);
@Html.TextBoxFor(m => m.Email);
@Html.TextBoxFor(m => m.UserName);
</div>
_signin page
@model demo4.Models.Login
<div>
@Html.TextBoxFor(m => m.UserName);
@Html.TextBoxFor(m => m.Password);
</div>