I have a drop down list for country and states.
And while binding the items on first time is not adding but in the second refresh page then it is selecting in the drop down values.
Code:
not in the page load some button click event fires then needs to show the corresponding values.
this.BindCountries();
ddlCountry.SelectedItem.Value = objAddressResponse.Country;
this.BindStates(objAddressResponse.Country);
ddlState.SelectedItem.Value =
ddlState.Items.Count > 1 ? objAddressResponse.State : "";
How to bind in the first time itself?
It is difficult to understand your code; Following is the a basic code for binding a drop down list to a data source.