When you use LoadOnDemand, your combobox does not bind until the user tries to expand it. Therefore, you cannot use the DataBound event.
I'm not sure what your use case is. If you want to simply display the selected item for the user, you can try using the Text property of your combobox in the Page_Load event.
protected void Page_Load(object sender, EventArgs e) { itemRCB_PO_NUM.Text = stringPO_NUM; }
If you really need the selected item, perhaps you can add a server with one item (sorry, I canβt check it right now)
protected void Page_Load(object sender, EventArgs e) { itemRCB_PO_NUM.Items.Add(new RadComboBoxItem() { Value = stringPO_NUM, Text= stringPO_NUM, Selected = true }) }
EDIT: I did a few, and it seems that the ItemDataBound event should be fired correctly:
Note. When you use the DataSourceID or DataSource properties to bind RadComboBox during on-demand automatic loading, the ItemDataBound event fires normally, which means you can use it to change the text properties and Item value, as well as to change its collection of attributes based on DataItem and etc.
So you can try using it:
protected void RadComboBox1_ItemDataBound(object o, RadComboBoxItemEventArgs e) { DataRowView dataSourceRow = (DataRowView) e.Item.DataItem; if(e.Item.Text == stringPO_NUM) { e.Item.Selected = true; e.Item.Value = stringPO_NUM; } }
But for me it is suspicious that on the screen that you indicated in the comments, I see that your string stringPO_NUM has a null value. I think this may be the reason why GetItemByText does not return you an element.
It would also be useful if you indicated why you need this item to select.
Machet
source share