I have a GridView in which I have added additional HeaderRows at various points to give the illusion of different sections to the GridView. The problem that I am having is that when I perform a postback the HeaderRows that I created turn into blank rows. I am able to add additional HeaderRows again but I then face the problem of the blank rows "bumping" the data into the incorrect "sections."
What I would like to do is, on postback, call a function that runs through the GridView and removes the blank rows/old HeaderRows and then call the function that added the HeaderRows in the first place.
I need help with the function to remove the rows. The code that I have right now for the function is:
protected void removeBlankRows()
{
foreach (GridViewRow row in GridView1.Rows)
{
if (row.Cells[6].Text == "")
{
//-->code to remove blank row here<--
}
}
}