There seems to be no way to manipulate Gridview columns if AutoGenerateColumns = true. Here is my scenario:
I have a generic GridView that displays the results of various LINQ queries depending on what the user selects. I like the fact that AutoGenerateColumns works as it should, and I do not need to specify all the columns of BoundField, TemplateField, etc.
In addition, I also programmatically add other columns as needed. Tables that are added programmatically are displayed to the left of the auto-generated columns. What if I want to move them to the right?
GridView.Columns.Count only counts those that are programmed, not auto-generated, so I cannot reorder the columns I need. I can hook up the RowDataBound event and βhideβ something if necessary, but I cannot reorder it.
Should I just discard AutoGeneratedColumns = true and lay them out with BoundFields for each query? Is there anything I can do?
Robert4Real
source share