Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1020
Column Order is not proper.
posted

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

Parents
  • 469350
    Offline posted

    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. 

Reply Children
No Data