views:

32

answers:

2

I want to display countries and the corresponding states in dropdownlist. Which method is efficient for storing the data in database and displaying it using updatepanel or filling dropdown at client side using javascript. I am confused which approach should I follow or is there any other way?

A: 

If you need to populate the list when the page is loaded you should use standard binding methods at the server side. If you need to populate the list when an action is performed later on the page you could use an UpdatePanel which will perform an ajax callback to the server. And finally the best option IMHO would be to have a server side action with caching enabled returning a JSON encoded representation of the countries which would be invoked using ajax and bound to a normal <select> without using any server side asp:DropDown...

Darin Dimitrov
A: 

Dear Confused, updatepanel will be better approach as you will not have to reload the whole page. But as user may go through the countries using up-down keys it will be easier if you trigger update of panel after user leaves countries dropdownlist.

PS:- Updatepanel is also client side approach. If you feel comfortable with jQuery then you can use jQuery ajax to upload states list.

TheVillageIdiot
thanx it will help me a lot to proceed
Deepali