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

Format selected item text based on several columns

1 Answer 31 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
ColinBowern
Top achievements
Rank 1
ColinBowern asked on 08 Jun 2009, 08:53 PM
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?

Thanks,
Colin

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 09 Jun 2009, 06:06 AM
Hi Colin,

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

CS:
 
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

Thanks
Shinu
Tags
ComboBox
Asked by
ColinBowern
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or