Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //First Html.BeginForm()
- @using (Html.BeginForm("AddFirst", "Student", FormMethod.Post, new { id = "form1", role = "form" }))
- {
- <tr>
- <td>
- @Html.LabelFor(model => model.MobileNo)
- @Html.EditorFor(model => model.MobileNo, new { htmlAttributes = new { id = "TextMobile", @class = "form-control", @maxlength = "10", @placeholder = "Mobile No" } })
- @Html.ValidationMessageFor(model => model.MobileNo, "", new { @class = "text-danger" })
- </td>
- <td>
- <input type="submit" name="submit" value="First Button" class="btn btn-default" />
- </td>
- </tr>
- }
- //Second Html.BeginForm()
- @using (Html.BeginForm("AddSecond", "Student", FormMethod.Post, new { id = "form2", role = "form" }))
- {
- <tr>
- <td>
- @Html.LabelFor(model => model.MobileNo)
- @Html.EditorFor(model => model.MobileNo, new { htmlAttributes = new { id = "TextMobile2", @class = "form-control", @maxlength = "10", @placeholder = "Mobile No" } })
- @Html.ValidationMessageFor(model => model.MobileNo, "", new { @class = "text-danger" })
- </td>
- <td>
- <input type="submit" name="submit" value="Second Button" class="btn btn-default" />
- </td>
- </tr>
- }
- [HttpPost]
- public ActionResult AddFirst(string submit, User u)
- {
- agree = new Agree(u);
- if (ModelState.IsValid)
- {
- //Some logic
- return View("ThisView", agree);
- }
- else
- {
- return View("ThisView", agree);
- }
- }
- [HttpPost]
- public ActionResult AddSecond(string submit, User u)
- {
- agree = new Agree(u);
- if (ModelState.IsValid)
- {
- //Some logic
- return View("ThisView", agree);
- }
- else
- {
- return View("ThisView", agree);
- }
- }
- [DisplayName("Mobile Number")]
- [Required(ErrorMessage = "* Please Enter Mobile Number")]
- public string MobileNo { get; set; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement