Format selected item text based on several columns

2 posts, 0 answers
  1. ColinBowern
    ColinBowern avatar
    51 posts
    Member since:
    Aug 2012

    Posted 08 Jun 2009 Link to this post

    I am trying to implement a RadCombobox that has multiple columns loaded on the fly from a page method after filtering based on what the user is typing:

    ID | Name | Address | City | Province

    When a user selects a row I want to populate the selected item with the format "ID - Name" and set the selected value to the ID field.  I am thinking that I need to do this with the OnSelectedIndexChanged event.  The data set in the tens of thousands of rows.  Is that the best method to change the text of the selected item?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Jun 2009 Link to this post

    Hi Colin,

    You may set the text of the selected item in the ItemDataBound event as shown below.

    protected void RadComboBox1_ItemDataBound(object sender, RadComboBoxItemEventArgs e) 
    //set the Text and Value property of every item 
           e.Item.Text = ((DataRowView)e.Item.DataItem["ID"].ToString() + " " + ((DataRowView)e.Item.DataItem["Name"].ToString(); 
    e.Item.Value = ((DataRowView)e.Item.DataItem)["ID"].ToString();  

    Multi-column ComboBox

Back to Top