Specified argument was out of the range of valid values. Parameter name: index
"
I have a GridView with some columns and I need to hide one column with GUID number , column[1] . It's very easy to make this :) you only need to write this in GridView_RowDataBound event :
protected void gvClanovi_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[1].Visible = false;
}
, but when I Set GridView properties "AllowPaging = True " and try to run page it show me the Error! . So we need to make some changes and I done this:
Check with this line of code :
if (e.Row.RowType == DataControlRowType.DataRow)
Event now looks like:
protected void gvClanovi_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[1].Visible = false;
}
}
That's all folk's ;)
nice it works
ReplyDeleteThank You Krishna ;)
ReplyDelete