The casting you are doing is based on the DataSource you have assigned
to the Repeater control.
In case of a DataTable is assigned to the Repeater.DataSource then you
can write a code similar like below,
private void _repeater1_ItemDataBound(object sender,
RepeaterItemEventArgs e)
{
RepeaterItem rItem = e.Item;
DataRow drv = (DataRow) rItem.DataItem;
...
}
If this doesn't help, put a debug mark inside this method and check the
type of "rItem.DataItem" using "Immediate Window" or "Quick Watch"
window. You can even see the data present in the DataItem object. Based
on that cast the "rItem.DataItem", It should work.
-
Vadivel Kumar
http://vadivelk.net
mavrick_101 wrote:
Hi,
I have a nested repeater and this is the code I have in the item data bound
event
private void _repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
RepeaterItem rItem = e.Item;
DataRowView drv = (DataRowView) rItem.DataItem;
.........
........
But when I complile I get an error that specified case is not valid (for
DataRowView).
Any help?