How to Reload/Rebind Spreadsheet

2 posts, 0 answers
  1. Brian
    Brian avatar
    1 posts
    Member since:
    Apr 2016

    Posted 23 May 2019 Link to this post

    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!

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    654 posts

    Posted 28 May 2019 Link to this post

    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.
Back to Top