I'm sure I've done this before but really cant remember how.
In the ItemDataBound event of a ListView I need to get the actual data value. I cant seem to find it in the ListViewItemEventArgs object that gets passed in.
Thanks
Use the ListViewDataItem in the ItemDataBound event:
protected void yourListView_ItemDataBound(object sender, ListViewItemEventArgs e)
{
ListViewDataItem dataItem = (ListViewDataItem)e.Item;
if (e.Item.ItemType == ListViewItemType.DataItem)
{
YourDataSource yourDataSource= (YourDataSource )dataItem.DataItem;
}
}
I think what you're after is the ListViewDataItem.DataItem
protected void Score_ItemDataBound(object sender, Telerik.Web.UI.RadListViewItemEventArgs e)
{
if (e.Item is RadListViewItem)
{
RadListViewDataItem item = e.Item as RadListViewDataItem;
object dataItem = ((System.Data.DataRowView)(((RadListViewDataItem)e.Item).DataItem)).Row.ItemArray[2].ToString();
string raetest = Convert.ToString(dataItem);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With