Hi,
I have an Ultragrid, which displays data from the table fetched through an object. Now, the order of columns is not the same as it is in the table. So, is there any way to change the order of columns in the grid dynamically?
Thanks in advance.
Regards,
Sangeetha
UltraGridColumn has a Swap method that swaps the location of the calling object with another UltraGridColumn. You'll have to do something like this:
ultraGrid1.DisplayLayout.Bands[0].Columns["source"].Swap(ultraGrid1.DisplayLayout.Bands[0].Columns["destination"]) ;
I guess you can also change column positions in the source DataTable using DataTable.SetOrdinal().
Thank you so much.
But, this would not help me because, my problem is this. I have an Ultragrid. Source for this grid, would be bound dynamically from the business layer which returns an ArrayList. Since this grid would be called at many points in the application, I want the business layer to return an Arraylist. Now, when the Arraylist is bound to the Datagrid, the order of the columns is not the same as what I want. So, I want to re-order the columns.
Is there any way to do it with the Infragistics Ultragrid methods? Or else, if there is a means by which I can loop through the array list and copy it to a data table, I can then re-order the columns using SetOrdinal method. But I don't know how to loop thru the ArrayList and copy the contents to a data table.
Pls help me out. Thanks in advance.