baskaran chellasamy

baskaran chellasamy

  • NA
  • 114
  • 150.6k

problem on binding data to combo box

Aug 8 2012 5:23 AM
Hi friends.
      I want to bind country,state,city to combobox.what i have done is country name has been bound to combobox1 at the page_load event. The below code for binding country
<pre>int i = 3;
            DataTable dt = ibl2.combo1(i);
            countrycombo.DataSource = dt;
            countrycombo.DisplayMember =Convert.ToString( dt.Columns["Country_name"]);
            countrycombo.ValueMember = Convert.ToString(dt.Columns["Country_id"]);</pre>
 
 The problem occurrs on the second stage.Binding the state name to combobox2 based on the country name.i have three tables country,state,city with relationship.The problem is when binding the statename to combobox2 at the combobox1_selectedIndexchanged event it take null value from country name.when i trace this process, combox1_selectedItem event occur  after the code<pre>countrycombo.DataSource = dt;</pre> in the page load itself. what i need is  this event should be occur after when i select the name of the country. what can i do.

Answers (1)