R – Accessing the full DataRow from the DataSource in a ListView ItemDataBound event handler

asp.netdatasourcelistview

Is it at all possible within a ListView ItemDataBound event handler to gain access to the full DataRow for that event? I need to do a lot of processing for the entire row on binding, but using data item values in the datarow that I am not actually using in the display itself.

Best Answer

Try this

DataRowView dr = (DataRowView)DataBinder.GetDataItem(e.Item);

using dr.Item.ItemArray you can access the entire row.