Question

I try to get the ColumnNames and the current Vieworder of my GridControl. The docu won't help me an the ".Net Reflector"-Tool also won't give me advice.

The tip from an other stackoverflowpost ( How to hide column of devexpress XtraGrid ) also won't help me, because, i can't access View.Columns

Was it helpful?

Solution

I suggest you are trying to use property gridControl.MainView to access a view. This property is of type BaseView (base class for all views) so in order to access columns/order information you should cast it to GridView (or whatever type you are using):

var firstColumnName = ((GridView)gridControl.MainView).Columns[0].FieldName;

OTHER TIPS

If you haven't populated the column collection , there will be no column to access.

This is something that you'll usually do while you are designing the grid.

Run designer -> Columns -> Retrieve Fields.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top