Updating web form control from SaveWorkbook method of custom spreadsheet provider

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    7 posts
    Member since:
    Jan 2012

    Posted 29 Oct 2018 Link to this post



    I have successfully implemented a custom provider for RadSpreadsheet following the example here: http://www.telerik.com/support/code-library/spreadsheetdatabaseprovider.


    I would like to be able to update a RadLabel on the same webform with some data derived from the saved sheet (for example, the count of rows). I have passed a reference to the RadLabel into the constructor of the custom provider and am setting it there:


        public class PerformanceSheetProvider : SpreadsheetProviderBase
            private readonly RadLabel _resultLabel;
            public PerformanceSheetProvider(RadLabel resultLabel)
                _resultLabel = resultLabel;
            public override void SaveWorkbook(Workbook workbook)
                _resultLabel.Text = workbook.Sheets[0].Rows.Count.ToString();


    However, the RadLabel value is not updated. I have also tried refreshing the update panel in which the label is contained in the client-side override of _onCallbackResponse:

    Telerik.Web.UI.RadSpreadsheet.prototype._onCallbackResponse = function () {
        $find("<%= RadAjaxPanel2.ClientID %>").ajaxRequest();


    ...but the label is still not updated.


    Any suggestions?



  2. Peter Milchev
    Peter Milchev avatar
    656 posts

    Posted 31 Oct 2018 Link to this post

    Hello Daniel,

    The save operation of the Spreadsheet fires a callback, and not a postback. This is the reason the label is not updated. 

    You can use the approach from Show messages to user after response from saving the Spreadsheet and use JavaScript and Ajax requests to update any control needed. For example, with JavaScript set the label message to a HiddenField, trigger a postback manually and in the code behind handling the postback, set the Label's text to be equal to the HiddenFields value. 

    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