To persist docking information into a data base, It is necessary to serialize the state information into a stream. After that, the stream is written into the database. Please refer to the below code snippet which illustrates this: C# private void button1_Click(object sender, EventArgs e) { // Saving dockstate to memory stream MemoryStream ms = new MemoryStream(); AppStateSerializer aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, ms); this.dockingManager1.SaveDockState(aser); aser.PersistNow(); //Code to store the memory stream into database.Depends upon the database MessageBox.Show("Saved in DB"); } private void button2_Click(object sender, EventArgs e) { //Code to retrieve data(stream) from database. Depends upon the database //Retrive dockState from DB String val = ""; byte[] bytes = System.Text.Encoding.ASCII.GetBytes(val); MemoryStream ms = new MemoryStream(bytes); ms.Position = 0; AppStateSerializer aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, ms); this.dockingManager1.LoadDockState(aser); MessageBox.Show("Loaded from DB"); } VB Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Saving dockstate to memory stream Dim ms As MemoryStream = New MemoryStream() Dim aser As AppStateSerializer = New AppStateSerializer(SerializeMode.BinaryFmtStream, ms) Me.DockingManager1.SaveDockState(aser) aser.PersistNow() 'Code to store the memory stream into database.Depends upon the database MessageBox.Show("Saved in DB") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'Code to retrieve data(stream) from database.Depends upon the database 'Retrive dockState from DB Dim val As String = "" Dim bytes As Byte() = System.Text.Encoding.ASCII.GetBytes(val) Dim ms As MemoryStream = New MemoryStream(bytes) ms.Position = 0 Dim aser As AppStateSerializer = New AppStateSerializer(SerializeMode.BinaryFmtStream, ms) Me.DockingManager1.LoadDockState(aser) MessageBox.Show("Loaded from DB") End Sub Sample: http://help.syncfusion.com/support/samples/KB/Tools.Windows/TDDBper/DBper.zip |
Article ID: | Published Date: | Last Revised Date: | Platform: | Control: |
1395 | 04/30/2011 | 07/10/2014 | WinForms | DockingManager |
Tags:
|
|
or the page will be automatically redirected to sign-in page in 10 seconds.