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
505
Saving/Restoring Column order at Runtime, no stream
posted

Hi

I wanted to restore column order of the grid to the layout in the form_load, after the columns have been moved around.  So I save it when the form loads, and trying to restore it when the button is clicked.  I don't want to use Save/Load it to/from a stream file, rather save it in an object so it can be restore later, and discarded after application closed.  Here is the code I have but it does not work:

private UltraGridLayout _layout;

private void Form1_Load( object sender, EventArgs e )

{

     .......

     // populate binding datasource which is the datasource of the grid

     this.bindingSource1.DataSource = datassource1;

     _layout = this.ultraGrid1.DisplayLayout;

     .......

} 

private void button1_Click( object sender, EventArgs e )

{

     this.ultraGrid1.DisplayLayout.Load( _layout, PropertyCategories.All );

     //this.ultraGrid1.Invalidate();

     //this.ultraGrid1.Refresh();

     Form1_Load( sender, e );

}

 

Please help!  Thanks.

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    You can't do it like this:

    _layout = this.ultraGrid1.DisplayLayout;

    becuase this just creates a reference to the layout, not a copy. So you need to create a clone of the original layout.

     _layout = this.ultraGrid1.DisplayLayout.Clone();

Children
No Data