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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridControl Export Problem

Thread ID:

Created:

Updated:

Platform:

Replies:

96523 Sep 19,2010 01:25 PM UTC Sep 28,2010 03:48 AM UTC Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 19, 2010 01:25 PM UTC

I am using the following routine to save the contents of a GridControl to disk:


void saveGrid(GridControl grid, string fname)
{
grid.BeginUpdate();
grid.RowCount++;
for (int c = 1; c <= grid.ColCount; c++)
{
grid[grid.RowCount, c].Text = grid[0, c].Text;
}
Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();
gecc.GridToExcel(grid.Model, fname);
grid.RowCount--;
grid.EndUpdate();
}

I transfer the header text to an additional row because the GridExcelConverter does not appear to save the header text to the file. Can this be corrected?

Also, I use the following routine to load the file back into the grid:

void loadGrid(string fname, GridControl grid)
{
grid.BeginUpdate();
Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();
gecc.ExcelToGrid(fname, grid.Model);
for (int c = 1; c <= grid.ColCount; c++)
{
grid[0, c].Text = grid[grid.RowCount, c].Text;
}
grid.RowCount--;
grid.EndUpdate();
}

(Again, I have to transfer the text back to the header cells.)

Now for the big problem. Some of the columns in the grid were set up as either comboBoxes or Pushbuttons. When I save and reload the grid, the cell type hasn't been saved and can't seem to be reset by setting the column style after reloading the grid. I assumed I could work around the failure of the export function to save the cell type information by simply reloading the contents and then resetting the cell type (and choicelist or pushbutton handler where needed). But setting the cell type and associated other attributes doesn't have any effect.

How can I work around this or solve it?

v/r
Jan




Administrator [Syncfusion]
Replied On September 19, 2010 01:37 PM UTC

I found a work around for the second problem (the cell types). I have to create a temporary grid and reload the file into that and then transfer the values, one at a time, into the original formatted grid. However, this seems to be a bit of a kludge. Is there a better way?

v/r
Jan



Christopher Issac Sunder K [Syncfusion]
Replied On September 28, 2010 03:48 AM UTC

Hi Jan,

Thank you for your interest in Syncfusion products.

You can use Serialization/De-Serialization methods to save/load the grid through XML Schema instead of doing exporting the grid. A sample regarding this has shipped in our DashBoard. It is available in the following location.

..\..\AppData\Local\Syncfusion\EssentialStudio\8.3.0.21\Windows\Grid.Windows\Samples\2.0\Serialization\Serialize Grid Control Demo\CS

Please let me know if you need any further assistance regarding this.

Regards,
Christo.



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;