views:

320

answers:

2

Hi, I need to access columns of infragistics ultragrid in same sequence in which they are being displayed in grid. If i can get the index of column in same sequence as they are visible on grid, i can fix my issues. Thanks in advance.

Lalit

A: 

I suppose you could try to handle the event that is fired when the order is changed and keep track of all the changes, but this seems like it is asking for subtle bugs to creep in.

I considered looping through all the columns and trying to use some property that would tell me their current position (maybe the TabOrder?) and use that to compile an inorder list of the columns. I guess you might have to loop through each colum using the Column.GetRelatedVisibleColumn() method.

I have not actually implemented it yet as I have other higher priority issues but that may be the road I end up going down.

auujay
+1  A: 
UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns[0];

Debug.WriteLine( "Columns in visible order: ");

       // Get the first visible column by passing in VisibleRelation.First.
       column = column.GetRelatedVisibleColumn( VisibleRelation.First );

       while ( null != column )
       {
           Debug.WriteLine( "   " + column.Key );

           // Get the next visible column by passing in VisibleRelation.Next.
           column = column.GetRelatedVisibleColumn( VisibleRelation.Next );
       }

http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v8.2~Infragistics.Win.UltraWinGrid.UltraGridColumn~GetRelatedVisibleColumn.html

GreyGhostStudio