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 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.
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.