I am new to asp.net mvc. with this link. I use Tuples to send two models in one view. I create two forms and two submit buttons; but the values ββare close to zero when 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 other view on 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 sending method
[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 must be viewed or submitted.
source share