Request.Form for DropDownList
I have on my view:
</td>
<td class="span-8 last">
<div class="editor-label">
<label for="Traslado_Movimiento_UbicacionFuncional_Id">Ubicación Funcional</label>
</div>
<div class="editor-field">
<select id="Traslado_Movimiento_UbicacionFuncional_Id" name="Traslado.Movimiento.UbicacionFuncional_Id"><option value=""> -- Seleccione -- </option>
</select>
</div>
</td>
And I want to get the selected value on the select.
On my controller I wrote:
string selecte开发者_StackOverflowd = Request.Form["Traslado_Movimiento_UbicacionFuncional_Id"];
But selected is always NULL....
Please, help!
Thx
You need to pass the input's name
, which contains .
s.
As mentioned, you would need to add the runat="server"
attribute. But why are you using the HTML select control if you want to use this from server code? It seems to make a lot more sense to use the ASP.NET combobox.
精彩评论