Ticket T286249
Visible to All Users

How to save Grid's layout to a database

created 10 years ago

[DevExpress Support Team: CLONED FROM DQ8006: saving grid xml layout to SQL database]
Hello Sasha
I am working in WPF with GridControl, Devexpress 14.2.6
I was trying to save my gridcontrol layout in my database with datatype XML but I have a serialization exception.
I use the code that I posted, is that the correct way to do that? I just want to save my layout in my database.
Thank you

Answers approved by DevExpress Support

created 10 years ago

Hi Osmani,
DXGrid provides the SaveLayoutToXML()/SaveLayoutToStream() and RestoreLayoutFromXML()/RestoreLayoutFromStream() methods allow saving/restoring the grid layout. You don't need to use DXSerializer to do so. For more information, see Saving and Restoring Layout.

Let me know your results.

    Comments (2)

      Yes I know but it is not allows me save the xml in the database. That's why I submit the ticket.
      I was playing around with the control like a week and I am not able to save as XML in my database.

      DevExpress Support Team 10 years ago

        Hi Osmani,

        Since this issue is not directly related to our controls but mostly to parameterized SQL queries, I am not sure that I can provide you with a precise solution. It would be better if you address your inquiry to MSDN Forum.

        Here my thoughts regarding this issue.
        If you don't plan performing XML-specific operations with a stored layout at the database level, I think it is better to use one of generic SQL types for compatibility reasons (such as nvarchar) to store data instead of using the MS SQL-specific XML type. I have prepared a small sample for your reference. See the attachment.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.