This is a migrated thread and some comments may be shown as answers.

How to Reload/Rebind Spreadsheet

1 Answer 80 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 23 May 2019, 01:10 PM

I have a spreadsheet in an ASPX page with a custom provider. I've built out the GetSheets and SaveWorkbook methods to retrieve data from and save data to a SQL database table. Since an ID is assigned to the record when inserted into the database (to determine whether to update or insert on next save), I'd like to reload the spreadsheet with current data after the save completes. So far I've tried the following:

-adding a spreadsheet.get_kendoWidget().refresh() to the end of Telerik.Web.UI.RadSpreadsheet.prototype._onCallbackResponse

-forcing a PostBack with _doPostBack() so I get Page_Init and Page_Load again

I've also looked through the forums and scanned through the javascript in the page itself, but I can't seem to find a way to force the control to reload itself after the Save completes. Any assistance or direction would be appreciated. Thanks!

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 28 May 2019, 08:23 AM
Hello,

I am sharing the answer from the duplicated support ticket for convenience and better visibility from the community.

The callback does not actually return any data, so if you need to refresh the Spreadsheet with new data from the server, a postback needs to be triggered. Another option is to override the response callback globally for all Spreadsheets as demonstrated here: https://www.telerik.com/support/kb/aspnet-ajax/spreadsheet/details/show-messages-to-user-after-response-from-saving-the-spreadsheet

<telerik:RadCodeBlock runat="server">
    <script>
         function SpreadsheetLoadEvent() {
            var spreadsheet = $find("<%= RadSpreadsheet1.ClientID %>");
            spreadsheet._onCallbackResponse = function () {
                __doPostBack("<%= RadSpreadsheet1.UniqueID %>", 'My Argument');
              }
            // Sys.Application.remove_load(SpreadsheetLoadEvent); 
        }
        Sys.Application.add_load(SpreadsheetLoadEvent);
    </script>
</telerik:RadCodeBlock>

<telerik:RadAjaxPanel runat="server">
    <telerik:RadSpreadsheet runat="server" ID="RadSpreadsheet1"></telerik:RadSpreadsheet>
</telerik:RadAjaxPanel>

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Spreadsheet
Asked by
Brian
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or