0
I have a dropdownlist that is set in my view as follows:
@Html.DropDownList("Exame", ViewBag.Exame as SelectList, "Escolha uma
opção...", new { @class = "form-control", @name="ExameARegistar" })
This dropdownlist should allow a registered user to register for an exam from a list. To do this, I will need to get the selected value from my controller.
I tried to use the Request.Form["ExameARegistar"]
but it always returns null. I would like to understand what is causing this error. Otherwise, I would like to know if there is a better alternative to Request.Form...
Already rents
Form["Exame"]
, which is defined inDropDownList
?– Ricardo Pontual
Request.Form["Exam"]? Yes, I have tried. And the same happens...
– brupal89
Tried to pass as parameter in Action,
public ActionResult SuaAction(string ExameARegistar)
?– Barbetta
@Barbetta not yet. I will try. How do I pass the selected value as input argument on the Submit button? This is my button already now: <input type="Submit" value="Add Exam" class="btn btn-default" onclick="Location.href='@Url.Action("Add Review", "Applications")' " />
– brupal89
You are using ASP.NET MVC or Webforms?
– perozzo