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
519
Issues with Persisting Grid Layout.
posted

Hi ,

I am using the Grid.DisplayLayout.SaveAsXml method for saving the layout and Grid.DisplayLayout.LoadAsXml for loading the grid layout from the files.

However when ever I load the layout , i dont get the exact setting I have stored in the file.

For ex , all hidden column appear , spacing settings are gone(AutoColumnSizze n all) , If we rename a column name for viewing ...it also gets restored as the original one.(ex.  if I set SecurityID as SecID in the Designer , it gets wiped off after loading from the file.)

I am using the following lines of code , Can some body please tell me If i am missing something.

 

 

 

 

System.IO.

 

FileStream FileLayout = new System.IO.FileStream(FileName, System.IO.FileMode

.OpenOrCreate);

 

 

if (FileLayout != null

)

{

FileLayout.Seek(0, System.IO.

 

SeekOrigin

.Begin);

 

 

if (this.DisplayLayout != null

)

 

 

this.DisplayLayout.Save(FileLayout, Infragistics.Win.UltraWinGrid.PropertyCategories

.All);

And for loading :

FileLayout.Seek(0, System.IO.

SeekOrigin.Begin);

 

if (FileLayout.Length > 0)

{

 

this.DisplayLayout.Load(FileLayout);

}

 

Thanks ,
Ashish.

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Ashish,

    I don't immediately see anything wrong with this code. My guess is that there's probably some kind of timing problem going on here. Like maybe you are loading the layout and then setting the DataSource on the grid which clears the layout. You need to set the DataSource first in such a case.

Children