Save/Open Grid Data

I am using the GridControl. Is there an easy way to save all the data in the grid to a file and then repopulate the grid with the data in the file later? Thanks

1 Reply

AD Administrator Syncfusion Team December 15, 2004 10:20 PM UTC

You can use LoadBinary and SaveBinary which are members of the GridModel class. LoadBinary is static, so you use it through the class name. Here are some code snippets.
[cs]
private void button2_Click(object sender, System.EventArgs e)
{
	//save to file
	this.gridControl1.Model.SaveBinary(@"c:\mygrid.grd");
}

private void button1_Click(object sender, System.EventArgs e)
{
	//load from file
	this.gridControl1.Model = GridModel.LoadBinary(@"c:\mygrid.grd");
}

[vb.net]
Private Sub button2_Click(sender As Object, e As System.EventArgs)
   ’save to file
   Me.gridControl1.Model.SaveBinary("C:\mygrid.grd")
End Sub ’button2_Click

Private Sub button1_Click(sender As Object, e As System.EventArgs)
   ’load from file
   Me.gridControl1.Model = GridModel.LoadBinary("C:\mygrid.grd")
End Sub ’button1_Click ’

Loader.
Up arrow icon