Hi,
I have a gridview with autogenerated fields, 2 template fields, 1 command field. Now, I want to hide one of the columns in a gridview .
I have a code written in rowdatabound
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[2].Visible = false;
}
this code works well when I have not introduced allow paging=true.
but when I have a page indexing property my code for pageindexingchanging is:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gridview1.pageindex=e.newpageindex;
fillgrid();
}
where fillgrid is a function which is simply binding data coming from data base in gridview.
when I add page indexing to my gridview I get an error:
Specified argument was out of the range of valid values.
Parameter name: index
on this line:
e.Row.Cells[2].Visible = false;
any help shall be appreciated.
thanks
shankbond