5

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

Community
  • 1
  • 1
Kevin Busch
  • 191
  • 1
  • 4
  • 17

2 Answers2

12

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;
pakeha_by
  • 2,081
  • 1
  • 15
  • 7
  • A little irritated at the hidden ways to get at some of the events and properties of DevEx controls. But +1 for you ...thanks! – IAbstract Nov 08 '12 at 21:20
1

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.

Stig
  • 1,323
  • 16
  • 22
  • Sorry for my late (realy late!) reply, but i wasn't the developer, i had to develop a test tool and had no access to the source code. – Kevin Busch Dec 08 '14 at 15:18