Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have dropdownlist that is bind to database. i insert "choose--langauge" item in it for defaul(dropdownlist1.items.insert(0,"choose--langauge"). i want when user select choose--langauge and after click submit button or selectedindex change than validation occur with messsage that Please select langauge or you cannot select choose langauge.

thanx.
Posted
Comments
Dr.Walt Fair, PE 3-Dec-10 23:42pm    
So what have you tried and what problem did it give you?
balongi 3-Dec-10 23:46pm    
my dropdownlist contain langauge like choose--langauge, hindi,punjabi,english
i want if user select chooselangauge item than the validation will come with message that you cannot select choose-langague but if user select hindi, punjabi than it will ok

I think, you are setting the intial value in page load itself.
So, whenever the page is posted back, selected index is set to default vaue 0.

Put a if condition to check post pack
Ex: if (Page.IsPostback)

Try : http://www.sforsearch.com/FPGHG[^]
 
Share this answer
 
For that please take a required field validator and set its control to validate property to DropDownlist1 and Set Initial Value as choose--langauge

It will help You
 
Share this answer
 
v2
You can use javascript for validation.
 
Share this 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