Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have a combobox in my content page.

I want to use validation for combobox & send its result as boolean to my master page because I have a method on master page which returns type as bool.

I need the user to select combobox before he can save or do any other operations.

I searched the net but didn't get good examples.
Posted
Updated 25-Mar-11 3:55am
v2
Comments
Dalek Dave 25-Mar-11 9:55am    
Edited for Grammar, Syntax and Readability.

Use RequiredFieldValidator if it's possible. In other cases you can configure and use CustomValidator which is more flexible cause you write your validation logic yourself.
 
Share this answer
 
Comments
Dalek Dave 25-Mar-11 9:55am    
Good Call
try this

XML
<asp:RequiredFieldValidator ID="rfv_Users" ControlToValidate="ddl_UserList" runat="server" ErrorMessage="Country"
                                    SetFocusOnError="true" InitialValue="Select" Display="dynamic">*</asp:RequiredFieldValidator>


give your dropdown 0 index value as select

dropdown.items.insert(0,"Select");
 
Share this answer
 
Comments
Dalek Dave 25-Mar-11 9:56am    
Good Answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900