ASP.Net-MVC code example to retrieve selected item from html dropdown list

Can someone give me some example code to return an element from html.dropdownlist?

+1


a source to share


1 answer


Suppose you have this DropDown in the view:

<p><label for="ProductType">Product Type:</label>
<br /><%=Html.DropDownList("ProductTypeDropDown", 
             New SelectList(ViewData("ProductTypes"), 
             "ProductTypeID", "Name"))%>
</p>

      



You can just get the selected value in the controller using

Product.ProductType = form("ProductTypeDropDown")

      

0


a source







All Articles