In MVC, I have a form that uses a lot of duplicate information. Basically, they press a button, and another โformโ appears (a drop-down list of text fields, etc.) that appears. When they press the submit button, but it all returns with the same name. How can I either make names different in Mail, or be able to drop items into a list?
My code is:
@Html.TextBox("Textbox1", "", new { placeholder = "", size = "77", maxlength = "76" })
@Html.DropDownList("Country", ViewData["CountryOptions"] as SelectList,"Select", new { id = "Country"})</div>
<div class="pad5">
<span class="FieldLabel">Application *</span><span>@Html.DropDownListFor(model => model.ProductsID, Model.HowProductsAreUsedOptions, new { @class = "General", id = "General-1" })
@Html.DropDownListFor(model => model.ApplicationValue, Model.Options, "--Choose One--", new { id = "Option1", style = "display:none" })
</div>
They can be repeated up to 9 times at the time of sending. However this will give me this in Post
FormID=8&Textbox1=This&Country=USA&ProductsID=1&ApplicationValue=2&
Textbox13=Is&Country=Canada&ProductsID=2&ApplicationValue=3&
Textbox14=A&Country=Canada&ProductsID=2&ApplicationValue=1&
Textbox15=Test&Country=Canada&ProductsID=1&ApplicationValue=8&
Textbox16=For&Country=Canada&ProductsID=2&ApplicationValue=1&
Textbox17=Stack&Country=USA&ProductsID=1&ApplicationValue=9&
Textbox18=Overflow&Country=USA&ProductsID=2&ApplicationValue=2
How can I do something in such a way that it can divide them into 7 different sets of values โโinstead of giving only one of them?
source
share