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.

Importing a datatable to a sheet - View not getting updated.

Thread ID:

Created:

Updated:

Platform:

Replies:

117328 Sep 29,2014 04:22 AM Oct 10,2014 06:52 AM WPF 1
loading
Tags: SpreadsheetControl(Classic)
stephly
Asked On September 29, 2014 04:22 AM

Hi . 

I'm using SpreadsheetControl in my application. 

I have to import a datatable to Worksheet ( the sheet can be anything that the user selects ) .

            SpreadsheetControl mySpeadsheetControl = Application.Current.MainWindow.FindName("mySpreadsheet") as SpreadsheetControl;
            IWorksheet sheet = mySpeadsheetControl.ExcelProperties.WorkBook.ActiveSheet;
            sheet.Activate();
            sheet.ImportDataTable(myGridContents, true, 1, 1);

When I do like this, the view is not getting updated. But if I click on some other sheet and then come back to this original sheet the view will be updated. How can i resolve this ? 

If I use the following method instead of  "sheet.ImportDataTable(myGridContents, true, 1, 1);"  
           mySpeadsheetControl.ImportFromDataTable(myGridContents); 
the view is getting updated immediately. But the problem with this is, whatever sheet I select , the changes happen only in Sheet1. Let me know if there is ant solution for this . 

Thanks in advance. 

Balakrishnan P [Syncfusion]
Replied On October 10, 2014 06:52 AM

Hi Stephly,

Thanks for contacting Syncfusion support.

You can achieve your requirement "view updated immediately when loading the data table" by using invalidatecells() and invalidatevisuals() method. Please find the below code snippet for your reference.

Code Snippet:

this.spreadsheetControl.GridProperties.ActiveSpreadsheetGrid.InvalidateCells();

this.spreadsheetControl.GridProperties.ActiveSpreadsheetGrid.InvalidateVisual();


Please let us know if you have any queries.

Thanks,
Balakrishnan.P

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.

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.

;