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
3914
Columns displayed in different order from UltraDataSource
posted

Hi,

I have an UltraGrid displaying data from UltraDataSource.

The weird thing about using UltraDataSource is if certain columns contain key with numbers/special characters, those columns are displays before other columns although no column sorting is done.

For example, the below Grid show Account 12 column before Portfolio column, whereas the underlying UltraDataSource has Account 12 column After Portfolio column.

Is there any reason for this? How can I prevent the Grid from automatically sorting the columns so.

Thanks

Sangeetha

Parents
  • 469350
    Offline posted

    Hi Sangeetha,

    It looks like maybe you intended to attach screen shots to your post, but they did not come through.

    The WinGrid does not do any sorting of the columns. The grid shows the columns in the same order in which the DotNet BindingManager returns the property descriptors. This order is arbitrary and there are no guarantees about what order they will be in, as far as I know.

    You can control the order of the columns in the grid using the column.header.VisiblePosition property. Setting this property in code can be a bit tricky, though, as you need to set the columns in the visible order. For example, you need to assign the column you want in position 0 first, then position 1, then position 2. Otherwise, you run the risk of a later column influencing the position of a prior column.

    There's a more detailed explanation of this (along with a sample project that demonstrates how you can set the columns our of order) here: Change the order of columns in Ultragrid - NetAdvantage for Windows Forms - WinGrid

Reply Children