ToString1
asked on
Mandatory selection for dropdown list in asp.net MVC 2
I have a strongly typed view populated from viewmodel that has dropdown list.
<%= Html.DropDownList("ID", Model.custList, "--select--")%>
<%= Html.ValidationMessage("ID ")%>
Which passes id to controller
public ActionResult Submit((int? ID)
I want to make dropdown mandatory so user must select an option
<%= Html.DropDownList("ID", Model.custList, "--select--")%>
<%= Html.ValidationMessage("ID
Which passes id to controller
public ActionResult Submit((int? ID)
I want to make dropdown mandatory so user must select an option
<%= Html.DropDownList("ID", Model.customereList, "--select--")%>
If it's mandatory you could just take out the "--select--" option and default to the first option in the list instead.
ASKER
Hi
No I need the select option as this is a request from the client
No I need the select option as this is a request from the client
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.