Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all

I have drop down list

and the it select from database
but I added to it item --select-- like that

ddlCat.Items.Insert(0, new ListItem("--Select--", "0"))


I want when user click save button and the dropdown in --select-- to make validation on it to choose from dropdown any other thing and never save befor select something??

thanx in advance
Posted
Comments
Sergey Alexandrovich Kryukov 16-May-12 17:18pm    
Not clear. It does not looks like making any sense. Do you want to identify a list element by its string? Why?
--SA

1 solution

If you add this as the first item in the drop down list, can you simply check that the selected item > 0 before accepting the input? So selecting the first item doesn't allow you to save the data.
 
Share this answer
 
Comments
Sandeep Mewara 17-May-12 1:14am    
Yep. 5!
Wendelius 17-May-12 4:30am    
Thanks :)

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