1
I got the following Html.BeginForm
(Don’t take into account if it’s incorrect is a legacy code and I can’t refactor it now).
using (Html.BeginForm("Confirm", "Download", new { ContributorID = "exemplo"}, FormMethod.Post, new { id = "confirm" })) {
<div class="form-group">
<label for="work_select">Selecione uma obra existente:</label>
<select class="form-control" id="work_select">
<option value="0" selected="selected">Selecione uma obra</option>
</select>
</div>
<p id="error-message"></p>
@Html.AntiForgeryToken()
<div class="inner-addon left-addon">
<i class="fa fa-download" aria-hidden="true"></i>
<input type="submit" value="@MainMessages.confirm_your_download" class="button-download" style="width:100%" />
<br />
</div>
}
Controller:
[HttpPost]
public ActionResult Confirm(string contributorID,string work_select)
If you noticed there is a parameter being added without using an input new { ContributorID = "exemplo"}
, I need it to stay that way, however the <select>
is not passing the value of work_select
for the controller, it arrives null
, how can I fix this?
Perfect Leandro, I ate ball with this... I’m so used to using the Razor Helper that I didn’t remember that part of the HTML itself.
– Leonardo Bonetti