I need to be able to programmatically get a list of the column headers that are currently being displayed in the grid. I.e. my grid has 8 columns; however, the user may have changed the order and hidden some of the remaining columns (via the column chooser).
How do I ask the grid to give me the columns currently displayed and in left to right order?
4 Answers, 1 is accepted
Thank you for writing.
You can iterate the RadGridView.Columns collections and check whether the column is visible or not by the GridViewColumn.IsVisible property. Here is a sample code snippet:
I hope this information helps. Should you have further questions I would be glad to help.
Dess, as usual you came through for me. Thanks, that solved my problem.
How would I exclude command columns in my loop? I've tried col.RadObjectType != typeof(GridViewCommandColumn) but the compiler says I can't do this.
Thank you for writing back.
I am glad that the provided code snippet was useful for your case. In order to exclude GridViewCommandColumns, you can refer to the following code snippet:
I hope this information helps. If you have any additional questions, please let me know.