how to populate CityWebDropDown Based on CountryId of CountryDropDown. using SqlDataSource.
ANY ONE KNOW THIS MEANS REPLY ME
I do this by surrounding both controls with an update panel. Each control needs a data source which points back to your city and state tables. The city data source will have the stateid as the select parameter (from a controlid) When the user selects a STATE, the SELECTEDINDEX CHANGED event will fire, inside this event code, you can rebind the city data source.
Protected Sub ddlCountry_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlCountry.SelectedIndexChanged ddlCity.Items.Clear() SqlDataSourceCity.SelectCommand = "SELECT [City] FROM [Cities] where [Country] = '" & ddlCountry.SelectedValue & "'" ddlCity.DataBind()End Sub
can you please upload a code snippet to illustrate? Thanks.