We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Save grid styles to database

Hi,

We're looking to save grid style information to our central database so that it can be repopulated on other computers when they grab the grid style data from the database.

Our plan is to save each cell style individually, using GridStyleInfo, and load up all cell style data from the database and apply it to our grid. We've run into some issues trying to serialize to binary and XML, as well as even trying to use XamlWriter and XamlReader on the GridStyleInfo object.

What would be the best way to save the GridStyleInfo properties?

Thanks in advance.

3 Replies

MS Mohamed Suhaib Fahad A. Syncfusion Team March 30, 2010 09:52 AM UTC

Hi Joe,

You can use the XmlSerialize to serialize and deserialize the grid styles, the styles should be converted to a serlizable list, Please check the below sample that shows serialization, likewise you can de-serialize and populate the grid.Model again,

http://www.syncfusion.com/uploads/redirect.aspx?file=sample_240d4fa4.zip&team=development

Thanks,
Fahad


JW Joe Ward March 30, 2010 02:57 PM UTC

Thanks. I'm looking to save each cell style individually. The sample app appears to save them all together.

The app helped me out by pointing me to the GridStyleInfoStore object. It has a WriteXml function, but I'm having some issues with it. When I go to use the GridStyleInfoStore.ReadXml function, it complains that there is more than one root element in the XML, which there is. It looks to be taking the properties I've changed, but not putting them under a root element. I see CellValue, Background and Tag, all three of which I set.

Sample:
http://www.w3.org/2001/XMLSchema" d2p1:type="q1:string" xmlns:d2p1="http://www.w3.org/2001/XMLSchema-instance">qwertySystem.Windows.Media.ImageBrush xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="ImageBrush">1System.Windows.Media.ImageBrushDAI.UI.Office.Interfaces.Compliance.TemplateDesigner.CellTypeNonEditable'>http://www.w3.org/2001/XMLSchema-instance">NonEditable

Is there some workaround so that I can save each cell style as it's own independent xml to be serialized to the database?

Thanks.


MS Mohamed Suhaib Fahad A. Syncfusion Team March 31, 2010 05:22 PM UTC

Hi Joe,

That is a bug we had before and we fixed it now, Can you please create a Direct trac incident so that we can follow up with the fix. Also, use the forum link as the title of your incident.

Thanks,
Fahad

Loader.
Live Chat Icon For mobile
Up arrow icon