Click here to Skip to main content
15,868,340 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Note:: It display an error when Allow paging is true and page size is any. In normal case when Allow Paging is false, there is no error.

My Code of Pageindexing::
C#
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        fillgrid(); // function to bind data
    }


I am using below code to hide a column in Gridview.

My code::
C#
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

e.Row.Cells[4].Visible =false;//error generated on this line

}


Error::
Specified argument was out of the range of valid values.
Parameter name: index


Please help me..
Posted
Updated 20-Nov-12 5:36am
v2
Comments
ZurdoDev 20-Nov-12 12:35pm    
I haven't tested it but I believe it may be due to timing of events. You may want to try the prerender event instead.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900