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
115
Win Grid Column(s) Order Changing Unexpectedly
posted

Hi,

I have a project where I use a number of UltraWinGrids version 6.2.  On the majority of grids when I set the order of the columns in the designer they appear in code as expected (Header.VisiblePosition = x),  however on grids used in a series of screens, despite the code appearing to be the same the columns appear in a different order than what is specified in the designer.   

Ultimately I just need to know what is being changed in the grids that causes them to ignore the visible position property?  The band is being added, the visible position property is set correctly in code.  I don't see any code that would change the default grid setting, but I must be missing something. Any ideas?

It appears from the code that the visible position is being changed when the control is bound to the data in these lines of code:

this.bindingSource1.DataSource = objBO.VBOData.DataSet;

//band[0].columns["mycolumn"].Header.VisiblePosition = 4

this.ultraGrid1.SetDataBinding(this.bindingSource1, null, true);

 //band[0].columns["mycolumn"].Header.VisiblePosition = 7

One thing I did try after looking through the forums was:

private void ultraGrid1_BeforeColumnChooserDisplayed(object sender, BeforeColumnChooserDisplayedEventArgs e)

{

  //e.Dialog.ColumnChooserControl.ResetSyncLookWithSourceGrid();

}

This does set the colums to the correct order, but would take away a lot of the combo box functionality.

Thanks,

Trevor

(yes I have spent too much time on this issue just to move column positions)