I have 50 properties in my BaseRow class. When I use the code mentioned below,the column order is random. BaseRow's properties are named col1,col2,col3....and so onupto col50. The ultragrid shows very random column order. I checked while debugging that the roots object contains perfect order. But when the columns are added in the Grid,the order is random.BaseRow headerrow = new BaseRow();BindingList<BaseRow> roots = new BindingList<BaseRow>();roots.Add(headerrow); ultraGrid1.DataSource = roots;
Please help,Regards,Sid.
Hi Mike,Yes, thats exactly what I did. I set the VisiblePosition property.But I was thinking if there could be a way to directly get the BindingListto provide the objects in proper order. Anyways, this works so its pretty fine.Regards,Sid.
Hi Sid,
I'm not sure what you mean. If you bind the grid so a list of object, then those objects do not have any order for the properties. It's just 50 properties - there is no defined order.
The grid gets the data from the DotNet BindingManager, and it gets the properties from the objects you are binding to. So the grid has no control over the order.
If your data source implements ITypedList, then the BindingManager uses the order in which the property descriptors are returned. But I suspect the BindingList just gets the properties in any old order.
What I would do is use the InitializeLayout event of the grid to set the column.Header.VisiblePosition on each column.
No I dont want to do anything at the design time. I simply have 50 properties. The property names becomethe column header names. I am using BindingList class.The propeties are in the order col1, col2, col3 ...and so on.Then why does the grid show randomly ordered columns??Regards,Sid.
If you want to control the order, bind the grid to a bindingsource with your object typoe in design time and reorder them as you like. In run time set the list as the data source of the bindingsource. See here:
http://forums.infragistics.com/forums/p/18975/68841.aspx#68841