Hi all,
I am adding an extra row into the header using following code:
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal );
TableCell cel = new TableHeaderCell();
cel.ColumnSpan = 2;
row.Cells.Add(cel);
System.Web.UI.WebControls.Table t = grid.Controls[0] as System.Web.UI.WebControls.Table;
t.Rows.AddAt(0, row);
This works fine. However, when I submit the GridView using Submit button, on postback I get data for one row less.
When I parse through the gridview rows, total number of rows received are correct. But I get the 2nd header row as the first row, and the last datarow is missing.
for (int i = 0; i < gdv.Rows.Count; i++)//parsing each row
{
txtBook = gdv.Rows.Cells[1].Text;
}
What am I doing wrong?
Any tips?
TIA,
Sheila
I am adding an extra row into the header using following code:
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal );
TableCell cel = new TableHeaderCell();
cel.ColumnSpan = 2;
row.Cells.Add(cel);
System.Web.UI.WebControls.Table t = grid.Controls[0] as System.Web.UI.WebControls.Table;
t.Rows.AddAt(0, row);
This works fine. However, when I submit the GridView using Submit button, on postback I get data for one row less.
When I parse through the gridview rows, total number of rows received are correct. But I get the 2nd header row as the first row, and the last datarow is missing.
for (int i = 0; i < gdv.Rows.Count; i++)//parsing each row
{
txtBook = gdv.Rows.Cells[1].Text;
}
What am I doing wrong?
Any tips?
TIA,
Sheila