G
Guest
I'm subscribing to the RowCreated event during GridView render process to
modify properties of individual rows. All works great when there is no paging
involved but once I specify that I'd like to use paging my code works only on
the first page.
Please look at the code; when the first page loads ID is set properly (for
each row) but when you navigate to another one you'd get NullReference error.
Why, I don't get it??
Sample pseudo-code:
void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int ID = ((DataRowView)e.Row.DataItem)["UserID"]
}
}
modify properties of individual rows. All works great when there is no paging
involved but once I specify that I'd like to use paging my code works only on
the first page.
Please look at the code; when the first page loads ID is set properly (for
each row) but when you navigate to another one you'd get NullReference error.
Why, I don't get it??
Sample pseudo-code:
void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int ID = ((DataRowView)e.Row.DataItem)["UserID"]
}
}