Hi there again,
Thanks so much for the reply.
I've almost got it, BUT i think i'm missing a partof the puzzle.
I've followed what it says in the link to the post you provided.
http://www.telerik.com/community/forums/thread/b311D-bamhdb.aspx
I found that when data-binding the RadListBox, the onItemDataBound event accepts a RadListBoxElement not a RadListBoxItem (as suggested) - is this correct?
I can pull out the object sent in via the ItemDataBoundEventArgs, and assign that to the RadListBoxElement.Tag. However, when i try and access the Tag value on the RadlistBoxItem later, it's null.
Is there anyway of assigning this to the Tag on the RadListBoxItem instead of the RadListBoxElement? Please see below for what i have currently coded... Something must be wrong here...
I have the following to populate the RadListBox and attach the event:
RadListBoxElement listBoxElement = (RadListBoxElement)this.lstPtyMedia.RootElement.Children[0];
listBoxElement.ItemDataBound +=
new ItemDataBoundEventHandler(onItemDataBound);
lstPtyMedia.DataSource = objPty.PropertyMediaCollectionByPropertyID;
lstPtyMedia.ValueMember =
"PropertyMediaID";
lstPtyMedia.DisplayMember =
"FileName";
The following is in the onItemDataBound event:
private void onItemDataBound(Object sender, ItemDataBoundEventArgs e)
{
PropertyMedia objPtyMedia = (PropertyMedia)e.DataItem;
RadListBoxElement lstElement = (RadListBoxElement)sender;
lstElement.Tag = objPtyMedia;
}
Thanks, and i look forward to your replly...
Regards,
ilya.