hi,
I have few columns that are initially hidden , they donot have a visible position set and When i use the columnchooser to add a column "B" to the ultragrid for the first time , it is added at the end(cause there is no visible position set).When i add one more column "A"(visible position not set)then it is added before the last added column("A").When i surfed for the reason i found out that thecolumn collection is a sorted collection.
My requirement is to add the column to the *** end of the Ultragrid when the user chooses it from the column chooser.How do i acheive this??
Thanks in advance,Vijay
Hi,
I think what you would need to do is handle either the BeforeColPosChanged or AfterColPosChanged event. You can examine the column header that is changing and see if it is being made visible and if so, set it's VisiblePosition. This probably involves comparing the new state of the header with the old state.
Hi ,
Thanks for the quick reply , i don't want to disturb the sort order of columns in the columnchooser dialog.They still have to be sorted Alphabetically.So the solution you have given doesn't help in my case. When i choose a column from the column chooser it needs to be added to the end of the grid.The grid shouldn't sort the columns after they are added from the column chooser dialog.It has to retain them in the order in which they are added.
You could handle the BeforeColumnChooserDisplayed event and set the ColumnDisplayOrder property of the control that is used to display the columns:
Example:this.ultraGrid.BeforeColumnChooserDisplayed += new BeforeColumnChooserDisplayedEventHandler
void ultraGrid_BeforeColumnChooserDisplayed(object sender, BeforeColumnChooserDisplayedEventArgs e){ e.Dialog.ColumnChooserControl.ColumnDisplayOrder = ColumnDisplayOrder.SameAsGrid;}