I'm trying to walk through every column in a WebDataGrid to save column visible index information, but when the WebDataGrid has AutoGeneratecolumns=true following code does not work because columns collection is empty.
foreach (GridField col in WebDataGrid.Columns){ sbColumnIndex.AppendFormat("{0}:{1};", col.Key, col.VisibleIndex);}
Is this a bug? or how can I get the columns collection on grids with autogeneratedcolumn = true.
thanks
OscarG
Hello Oscar,Just like in the GridView, the Columns collection contains only the column objects that were added by hand in either aspx or in the code behind.The autogenerated columns are for the display purpose only, they cannot be accessed or modified.