I have dropdownlist,I want to get the selected value from the view and store it in a variable in the controller in order to reuse it.
Here's my code :
Index.cshtml
@using (Html.BeginForm("Register", "Home", FormMethod.Post))
{
<table style="text-align: left; width: 900px; height: 160px;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 559px;">
<select id="select1" name="select1">
<option value="1">1 BAL Active</option>
<option value="2">2 BAL Actives</option>
<option value="3">3 BAL Actives</option>
<option value="4">4 BAL Actives</option>
<option value="5">5 BAL Actives</option>
<option value="6">6 BAL Actives</option>
</select>
</td>
</tr>
</tbody>
</table>
<button type="submit" class="btn btn-default">Register </button>
}
In my Controller I've add a variable to get the selected value :
Controller.cs
var selectedOption = Request["select1"];