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
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
Hi Mike,
Thank You for your reply.
For some reason it did not show my Image in the post although I pasted it. But here it is again.
Contrary to what you mentioned, I noticed that the Grid somehow changed only the visiblePosition of the First Column in the second band - have no clue why... I don't set VisiblePosition anywhere in my code, so it is really weird.
Yes I understand I can as a workaround set the VisiblePosition property to 0 to not apply it.
Thanks Danko, I attached this way in another post and it worked.
Thanks Michael.
Hello Sangeetha Thai,
Thanks for your feedback.
If you would like to attach images directly to the post, you could use the "OPTIONS" tab, when you are replying to a post and there is "File Attachment" option that will allow you to post your screenshot.
Please feel free to let me know if I could assist you further with this matter.
No luck - the Image just won't show up. But thanks anyway Mike.