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
40
LoadFromXML - Root element is missing
posted

I am trying to allow the user to be able to reload the grid's default/original DisplayLayout after a custom DisplayLayout has been applied. I have a test project that doesn't have much in it except for the save and load functions. When I try to do this using the file system to save the xml instead of a stream, everything works perfectly. When I try to use a Stream, I get an error that says, "Root element is missing." The default/original DisplayLayout will load fine if I don't pass it a custom DisplayLayout to load. The custom DisplayLayout will load fine as well, but when I try to revert back to the default/original, it blows up. In the application I am going to put this into, I can't use the file system as the user will not have rights to write to the file system. This is why I am using a Stream to hold the grid configuration in the meantime. Am I doing this wrong or is there another way to do this?

 

private Stream _defaultGridConfig = null;

public Stream CurrentGridConfig
        {
            get
            {
                MemoryStream stream = new MemoryStream();
                this.DisplayLayout.SaveAsXml(stream, PropertyCategories.All);
                return stream;
            }
        }

public void Init(Stream UserGridConfiguration)
        {
            _defaultGridConfig = CurrentGridConfig;

            if (UserGridConfiguration != null)
                this.DisplayLayout.LoadFromXml(UserGridConfiguration, PropertyCategories.All);
        }

private void ResetGridSettingsEvent(Object sender, EventArgs e)
        {
            if (_defaultGridConfig != null)
                this.DisplayLayout.LoadFromXml(_defaultGridConfig, PropertyCategories.All);
        }

Parents
  • 340
    Offline posted

    Hi Kyle,

    I don't have a solution for you, but I happen to have a similar problem except using VB.  I was able to get this working with 7.3 and has been working for some time now (saving and loading using a stream).  The problem started happening when I upgraded my Infragistics controls to 8.1.  Now I can't load setting I previously saved under the 7.3 version.  Have you been able to solve this yet? 

Reply Children