This is a migrated thread and some comments may be shown as answers.

how can i select item from combobox?

1 Answer 58 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
EdyTeddy-1975
Top achievements
Rank 2
EdyTeddy-1975 asked on 23 Jul 2010, 10:31 AM

 

 

int idx = RegionCombo.FindItemIndexByValue(Convert.ToString(query.Region));

 

RegionCombo.Items[idx].Selected =

 

true;

 



not working and Combo.SelectIndex not work too. just i need on server do select like as user select item. But Text in combox is still sam - > first

thanx

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Jul 2010, 02:12 PM
Hello,


In which event are you trying the code? Are you trying the code after binding the RadComboBox control?

If you want to select an item after data is bound, then try the code in DataBound event of RadComboBox.
C#:
protected void RadComboBox1_DataBound(object sender, EventArgs e)
{
    int idx = RegionCombo.FindItemIndexByValue("6");
    RegionCombo.Items[idx].Selected = true;
    // (RegionCombo.FindItemByValue("5") as RadComboBoxItem).Selected = true;
}


Could you provide some more information about the scenario, if this does not help?

-Shinu.
Tags
ComboBox
Asked by
EdyTeddy-1975
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or