asp.net mvc - How to submit @using (Html.BeginForm()) and submit its content to controller -
i'm trying send 6 values 6 different text boxes controller. how can without using javascript?
@using (html.beginform("save", "admin")) { @html.textbox(valueregular.tostring(format), new { @name = "pricevalueregularlunch" }) @html.textbox(valueregular1.tostring(format), new { @name = "pricevalueregularlunch1" }) @html.textbox(valueregular2.tostring(format), new { @name = "pricevalueregularlunch2" }) <input type="submit" name="savebutton" value="save" /> } [httppost] public actionresult saveprices(int pricevalueregularlunch) { return redirecttoaction("lunch", "home"); }
here's controller should like:
public class admincontroller : controller { [httppost] public actionresult saveprices(int pricevalueregularlunch, int pricevalueregularlunch1, int pricevalueregularlunch2, int pricevalueregularlunch3, int pricevalueregularlunch4, int pricevalueregularlunch5) { return redirecttoaction("lunch", "home"); } }
and view:
@using (html.beginform("saveprices", "admin")) { @html.textbox("pricevalueregularlunch") @html.textbox("pricevalueregularlunch1") @html.textbox("pricevalueregularlunch2") @html.textbox("pricevalueregularlunch3") @html.textbox("pricevalueregularlunch4") @html.textbox("pricevalueregularlunch5") <input type="submit" name="savebutton" value="save" /> }
Comments
Post a Comment