Hi,
I have Ultra Grid in windows application. I want to change column display order at runtime.
I'm wondering if there is a way to change the display order of column. Please help me ASAP
Yes, use the InitializeLayout event and set the column.Header.VisiblePosition on each column. Note that you must set the columns in order so as to prevent the positoin of one column from interfering with another.
So this is correct:
e.Layout.Bands[0].Columns["My First Column"].Header.VisiblePosition = 0;
e.Layout.Bands[0].Columns["My Second Column"].Header.VisiblePosition = 1;
e.Layout.Bands[0].Columns["My Third Column"].Header.VisiblePosition = 2;
This would be wrong:
e.Layout.Bands[0].Columns["My First Column"].Header.VisiblePosition = 2;
e.Layout.Bands[0].Columns["My Second Column"].Header.VisiblePosition = 0;
Thank you for the fantastic and brilliant answer.
I am linking a WinCombo to a control and depending upon whether the entry is numeric or alphabetical, I can then change the dataview.sort field.
Thus I can show the combo with the first column being the sorted one.