I'm not sure this gets me what I need.
The "MyObject" I refered to has several properties I need to display in the list box, not just a Text and a Value. So I can't simply rely on those two properties exposed by the RadListBoxItem.
I tried referencing the DateItem property inside my InstantiateIn method, but while this works initially, after any subsequent postbacks I'm left with an empty item again since the DataItem property doesn't survive the postbacks like the Text and Value properties do.
public void InstantiateIn(Control container)
object dataItem = ((RadListBoxItem)container).DataItem;
someControl.Text = (string)DataBinder.Eval(dataItem, "Property1");
someOtherControl.Text = (string)DataBinder.Eval(dataItem, "Property2");
anotherControl.Text = (string)DataBinder.Eval(dataItem, "Property3");
I was sure to assigned IDs to the controls I'm adding so that ViewState is preserved between postbacks, but I must be missing something.