Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two dropdown in on page.I put requirefield on both.
i have to do like this ....
when i click on submit button, if i have select one of them, then validation will not fire second dropdown .i have to fill only one dropdown when i submit data.But validation fire on both .how to solve this problem.
Posted
Comments
Kuthuparakkal 12-Jan-13 0:40am    
Whatve you tried so far ?
Shanu2rick 12-Jan-13 1:24am    
Make a validation group of the first dropdownlist and the Submit button.

On page submit, raise a JS method. In it, find the selected value of both dropdowns. If you find any one of them having value, let the page postback. If you find both of them not selected, raise an alert and cancel postback.

Try out.
 
Share this answer
 
C#
if(drp_list1.text==""){MessageBox.Show("Enter Data");return;}
if(drp_list2.text==""){MessageBox.Show("Enter Data");return;}

Try this.
 
Share this answer
 
v2
you can switch CausesValidation property of DropDown to True/False.
 
Share this answer
 
v2

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