how can i select item from combobox?

2 posts, 0 answers
  1. EdyTeddy-1975
    EdyTeddy-1975 avatar
    11 posts
    Member since:
    May 2010

    Posted 23 Jul 2010 Link to this post

     

     

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Jul 2010 Link to this post

    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.
Back to Top