Click here to Skip to main content
15,896,468 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In my master page i have three dropdownlists(State,District,Area) and some links(Schools,Hospitals,Busstands).And i have inserted the details of schools,hospitals....by giving Area id as foreign key .Now when i select state district and area it displaying the details of schools hospitals of that selected area.Now the question is, when i click link(Schools,Hospitals,Busstands) directly( not selecting dropdownlist) it showing error (Incorrect syntax near '=' , da.Fill(ds);),i wants to show a message as PLEASE SELECT YOUR AREA
Posted
Comments
DamithSL 21-Dec-14 5:29am    
update the question with your code

1 solution

you can use requiredfieldvalidator and set the initial value as default value of the area drop down
check the sample codes given in the documentation RequiredFieldValidator.InitialValue[^]
by using requiredfieldvalidator you can check inputs without going to server side validation.
if you want to do the same in server side c# code; check the value of area code before you fetch the data from the database. if it is empty you can show message and exit the data loading method without executing database select statement
 
Share this answer
 
v2
Comments
Member 11052105 21-Dec-14 4:37am    
i have got confused sir. how can i show a message(Please select your area) if user click the link without selecting area from dropdownlist,can you please attach the sample sir

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