TelerikDeveloper.com

TelerikDeveloper.com

sgray128 8/24/2015 7:03:17 PM

Winforms - RadGridView Save and Load

This article details how to save and restore the geometry for a Winforms RadGridView



Dim oFPUserSetting As FPUserSetting
 
'restore grid1 geometry
oFPUserSetting = New FPUserSetting("Geometry", String.Format("{0}RadGridView1", Me.Name), App.UserName, App.Database)
If oFPUserSetting.isPopulated Then
    Dim byteArray As Byte() = Encoding.UTF8.GetBytes(oFPUserSetting.SettingValue)
    Dim ms As MemoryStream = New MemoryStream(byteArray)
    Me.RadGridView1.LoadLayout(ms)
End If

 

Dim swRadGrid As New StringWriter
Dim xw As XmlWriter = XmlWriter.Create(swRadGrid)
Me.RadGrid1.SaveLayout(xw)
xw.Flush()
DynData.SPs.FP_FPUserSetting_Merge("Geometry", String.Format("{0}_RadGridDragAndDrop1", Me.Name), swRadGrid.ToString, App.UserName, App.Database).execute()