Lorna70
asked on
onRowDataBound Foreach not going into Footer
Hi
When I debug, my program is not going into the else if(gvr.RowType == DataControlRowType.Footer) part. There is definitely a footer in my GridView and it displays on the page but for some reason my foreach doesn't recognise it - my code is as follows:
public void GridView1_DataBound(object sender, EventArgs e)
{
foreach (GridViewRow gvr in gvReportonPortCatches.Rows )
{
if (gvr.RowType == DataControlRowType.DataRow )
{
//do stuff here
}
else if(gvr.RowType == DataControlRowType.Footer)
{
//do stuff here
}
}
}
Please can someone advise me why this is not working as expected??
When I debug, my program is not going into the else if(gvr.RowType == DataControlRowType.Footer)
public void GridView1_DataBound(object
{
foreach (GridViewRow gvr in gvReportonPortCatches.Rows
{
if (gvr.RowType == DataControlRowType.DataRow
{
//do stuff here
}
else if(gvr.RowType == DataControlRowType.Footer)
{
//do stuff here
}
}
}
Please can someone advise me why this is not working as expected??
ASKER
Thanks but I'm using onDataBound not onRowDataBound.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks and sorry for the wrong title (oops!). This has worked except the row is not going into the correct place in the footer as there is already a row there and I need it to go above that row. To be fair I'll post this problem as another question :-)
Open in new window