I am new to asp.net mvc. with this reference this. i am using Tuples to send two models in to one view. i am creating two forms and two submit buttons ; but values are coming to null when it the server
@model Tuple<DAL.Models.LoginModel, DAL.Models.ForgotPassword>
@{
ViewBag.Title = "Login";
}
@using (Html.BeginForm("Login", "User", FormMethod.Post, new { ReturnUrl = ViewBag.ReturnUrl }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<ol>
<li>
@Html.LabelFor(m => m.Item1.EmailID)
@Html.TextBoxFor(m => m.Item1.EmailID, new { @id = "txt_login_EmailID" })
@Html.ValidationMessageFor(m => m.Item1.EmailID)
</li>
<li>
@Html.LabelFor(m => m.Item1.Password)
@Html.PasswordFor(m => m.Item1.Password)
@Html.ValidationMessageFor(m => m.Item1.Password)
</li>
<li>
<input type="submit" value="Login" id="btn_login" />
@Html.CheckBoxFor(m => m.Item1.RememberMe)
@Html.LabelFor(m => m.Item1.RememberMe, new { @class = "checkbox" })
</li>
</ol>
</fieldset>
}
this another form in the same page
@using (Html.BeginForm("ForgotPassword", "user"))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<ol>
<li>
@Html.LabelFor(m => m.Item2.EmailId)
@Html.TextBoxFor(m => m.Item2.EmailId, new { @id = "txt_fg_pwd_EmailID" })
@Html.ValidationMessageFor(m => m.Item2.EmailId)
</li>
<li>
<input type="submit" value="Reset Password" />
</li>
</ol>
</fieldset>
}
my post method is
[HttpPost]
public ActionResult Login(LoginModel LoginUser , string returnUrl)
{
if (LoginUser.IsValid)
{
SetAuthenticationCookie(LoginUser, LoginUser.RememberMe);
return RedirectToLocal(returnUrl);
}
else
{
ModelState.AddModelError("", "Incorrect user name or password .");
return View(LoginUser);
}
}
`
Any changes need to to view or post method