write ur code in DataBound(Grid view) event myDataGrid.Columns[0].Visible = false;
2009/4/3 eddiec <[email protected]> > > Hi, > > I am trying to hide a column of a gridview > > Code in C# is > myDataGrid.Columns[0].Visible = false; > > When I run the code I receive an error: > Exception Details: System.ArgumentOutOfRangeException: Index was out > of range. Must be non-negative and less than the size of the > collection. > Parameter name: index > > I guess the probem is that where I am accessing the grid it hasn't > been rendered yet. > > I have tried putting the code after data binding in the page load > event and also in the RowDataBound event handler but receive the same > error either way. > > Help! > > cheers > > eddiec :-) -- Regards ******************* *C.Arun Kumar * *******************
