A
Adam J Knight
Hi all,
I have a datagrid which is bound to a DATA READER object.
During its item bound event i am trying to retrieve a particular value from
the dataitem property.
Code:
public void dgEnrollments_ItemBound(object sender, DataGridItemEventArgs e)
{
Response.Write(((DataRowView)e.Item.DataItem).Row.ItemArray[2].ToString());
//line causing errror.
}
Unfortunately i am getting the following error.
Unable to cast object of type 'System.Data.Common.DbDataRecord' to type
'System.Data.DataRowView'.
Anyone know how to fix this??
Cheers,
Adam
I have a datagrid which is bound to a DATA READER object.
During its item bound event i am trying to retrieve a particular value from
the dataitem property.
Code:
public void dgEnrollments_ItemBound(object sender, DataGridItemEventArgs e)
{
Response.Write(((DataRowView)e.Item.DataItem).Row.ItemArray[2].ToString());
//line causing errror.
}
Unfortunately i am getting the following error.
Unable to cast object of type 'System.Data.Common.DbDataRecord' to type
'System.Data.DataRowView'.
Anyone know how to fix this??
Cheers,
Adam