0

Would like to ask whether this way is correct or not to call two actions in a begin form

This works fine for me,would like to know whether this is the correct way or not.

I have added formaction="/Controller/Action" in button.

View

@using (Html.BeginForm("FileUpload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{

<input type="submit" value="Update" id="btnSubmit" />

<input type="submit" value="Reset" formaction="/Home/Reset" id="btnReset"/>
}
adiga
  • 34,372
  • 9
  • 61
  • 83
Dave
  • 263
  • 6
  • 23
  • What is you `Reset()` method doing? Do you really need do a POST as opposed to a simple redirect? –  Jul 21 '16 at 06:22
  • Refer this question http://stackoverflow.com/questions/442704/how-do-you-handle-multiple-submit-buttons-in-asp-net-mvc-framework – unique Jul 21 '16 at 07:05
  • Reset will clear all the textbox. public ActionResult Reset(Person person) { try { ModelState.Clear(); return RedirectToAction("Index"); } catch (Exception) { throw; } } – Dave Jul 21 '16 at 10:11
  • Can you help me out with this question http://stackoverflow.com/questions/38483191/retain-image-on-view-before-submit-returns-null-on-submit – Dave Jul 21 '16 at 10:15

0 Answers0