Is there a way to get the actual column position that is displayed in the grid. Not the visible position within a group but the position that is displayed in the grid.
Example:
Shipping Group Billing Group
ShipAddress ShipCity ShipState ShipZip BillingAddress BillingCity BillingState BillingZip
If I get the visible position of BillingAddress it will return 0
Is there a way to get the actual position which is 4 without iterating over each group and the over each column to determine its actual position?
I want to get this without iterating over each group and column.
ShipAddress: 0
ShipCity: 1
ShipState: 2
ShipZip: 3
BillingAddress: 4
BillingCity: 5
BillingState: 6
BillingZip: 7
Hello Jason,
Could you please let us know which RowLayoutStyle are you using in your app, so I can make a sample and see if there is a reliable way to get the column order.
Looking forward to your reply.
Sincerely,
Tihomir TonevAssociate Software DeveloperInfragistics
The process I am currently using is
foreach of Groups ordered by visible position that is not hidden
foreach Columns from Group by visible position that is not hidden
add column to list
foreach rows
for columns
get cell data based on column key
output to txt file.
I was wanting a way to get the actual column position in the grid.
This gets the columns in the order that the user sees displayed on the grid because the user can move any column within the group and hide columns. I need the actual position of the column relative to the grid but not within the group to ensure when I export the grid to txt file that I have it in the column order in which the user has specified.
You can try with the following approach:
UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].GetFirstVisibleCol(this.ultraGrid1.ActiveColScrollRegion, true);
Debug.WriteLine("Columns in visible order: ");
// Get the first visible column by passing in VisibleRelation.First. column = column.GetRelatedVisibleColumn(VisibleRelation.First);
while (column != null) { Debug.WriteLine(" " + column.Key);
// Get the next visible column by passing in VisibleRelation.Next. column = column.GetRelatedVisibleColumn(VisibleRelation.Next); }
Please let me know if this method doesn't work.
Sorry for taking so long to get back to you, but I was able to get it working with your code. Thank you for your help.
Glad to hear that I was able to help.
Thank you for using Infragistics components.