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. Image for the cookie policy date

Refresh sheets

In sfSpreadsheet ,I load the excel template and set data  in code,.it has two sheets.How to refresh all sheets in sfSpreadsheet ,spreadsheet.ActiveGrid.InvalidateCells() seems only refresh the active grid.

3 Replies

KB Kanimozhi Bharathi Syncfusion Team July 1, 2016 10:49 AM UTC

Hi Ray,   
   
You can access each SpreadsheetGrid in SfSpreadsheet by invoking the WorkbookLoaded Event  or by  passing the worksheet name in  GridCollection Property  and call the  InvalidateCells method to refresh the view.   
   
Please find the code example for your reference,   
   
spreadsheet.WorkbookLoaded += spreadsheet_WorkbookLoaded;   
   
void spreadsheet_WorkbookLoaded(object sender, WorkbookLoadedEventArgs args)   
{    
   foreach (var grid in args.GridCollection)   
   {   
     grid. InvalidateCells();   
   }   
   
}   
   
OR   
   
var sheet1 = spreadsheet.Workbook.Worksheets[0];   
var sheet2=  spreadsheet.Workbook.Worksheets[1];   
spreadsheet.GridCollection[sheet1.Name].InvalidateCells();   
spreadsheet.GridCollection[sheet2.Name].InvalidateCells();   
   
  
   
   
You can also refer the below UG links to access each grid and refreshing the view,   
   
   
   
Regards   
Kanimozhi B   



RA ray July 4, 2016 03:48 PM UTC

Thanks!


KB Kanimozhi Bharathi Syncfusion Team July 5, 2016 09:13 AM UTC

Hi Ray, 
Thank you for your update. 
Regards 
Kanimozhi B 


Loader.
Live Chat Icon For mobile
Up arrow icon