DropDown Retrieve Data but Select no item

  • Thread starter Thread starter Matthias Marx
  • Start date Start date
M

Matthias Marx

Hello,

i want to retrieve Data an bind the Data do a dropdown list.
Is is working, but allways the first entry is selcted.

but want that now value is selected?

How could i do this

thx

matthias
 
* "Matthias Marx said:
i want to retrieve Data an bind the Data do a dropdown list.
Is is working, but allways the first entry is selcted.

but want that now value is selected?

Try this:

\\\
ComboBox2.SelectedIndex = -1
ComboBox2.SelectedIndex = -1
///

Notice that you have to set this twice to "fix" a bug with the combobox
control.
 
Hi

it doesn't work.

here my code,
may be there is a mistake
Try this:

\\\
ComboBox2.SelectedIndex = -1
ComboBox2.SelectedIndex = -1
///

this.cbCountry.DataSource=GetCountry.GetAllCountriesEnabled();
this.cbCountry.DisplayMember = "Table.ISOCode2";
this.cbCountry.ValueMember="Table.CountryId";
this.cbCountry.SelectedIndex=-1;
this.cbCountry.SelectedIndex=-1;


Thank you

Matthias
 
I'm personally not sure about this, but isnt the DisplayMember and
ValueMember supposed to be set *before* the propset DataSource?

Obviously in ASP.Net it would [before a call toDataBind()] I'm guessing
maybe thats a symptom?
 
Back
Top