Lorna70
asked on
Code removing the wrong cells - how do I get the value of a cell in GridView
Hi I'm trying to add rowspan to the first cell in a group and then removing the subsequent cells but my code seems to be removing the wrong cells (e.g gvr.Cells.RemoveAt(0);). How can I get the value of a cell in the following code so I can determine which cells are actually being removed??
foreach (GridViewRow gvr in gvWeeksCatches.Rows)
{
gvRowIndex = gvr.RowIndex;
if (gvRowIndex == firstSpanRow)
{
gvr.Cells[0].RowSpan = numSpanRows;
gvr.Cells[1].RowSpan = numSpanRows;
}
//if row is in rowspan group
else if (gvRowIndex > firstSpanRow && gvRowIndex <= lastSpanRow)
{
gvr.Cells.RemoveAt(0);
gvr.Cells.RemoveAt(1);
}
gvRowIndex++;
}
foreach (GridViewRow gvr in gvWeeksCatches.Rows)
{
gvRowIndex = gvr.RowIndex;
if (gvRowIndex == firstSpanRow)
{
gvr.Cells[0].RowSpan = numSpanRows;
gvr.Cells[1].RowSpan = numSpanRows;
}
//if row is in rowspan group
else if (gvRowIndex > firstSpanRow && gvRowIndex <= lastSpanRow)
{
gvr.Cells.RemoveAt(0);
gvr.Cells.RemoveAt(1);
}
gvRowIndex++;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It was a bit of a glaring error but I've been down this road with similar issues so many times before - sometimes you just need a fresh pair of eyes on the subject.
Glad to have saved some of your hair, even if it's too late for mine. ;-)
Glad to have saved some of your hair, even if it's too late for mine. ;-)
ASKER