Help on dropdown list

Posted by Vijayar under ASP.NET on 5/4/2011 | Points: 10 | Views : 855 | Status : [Member] | Replies : 1
Hi , i want a country dropdownlist which will display country name and list of the states under the country name below it from 2 i.e tables countries and states with an example

Ex:
India

Andhrapradesh
Usa
mexico

vijaya


Responses

Posted by: Nishithraj on: 5/4/2011 [Member] Bronze | Points: 25

Up
0
Down
You can try something like this
sqry = "SELECT a.states+' '+b.country as statecountry FROM state a left outer join country b on a.countryid=b.countryid" 

sqcom = New SqlCommand(sqry, sqcon)
da.SelectCommand = sqcom ds.Clear()
da.Fill(ds)
ddl_adv.DataSource = ds
ddl_adv.DataTextField = "emp_fullname"
ddl_adv.DataValueField = "emp_no"
ddl_adv.DataBind()
sqcon.Close()


Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response