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

Updating web form control from SaveWorkbook method of custom spreadsheet provider

1 Answer 179 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 29 Oct 2018, 07:48 PM

Hello,

 

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?

 

Thanks!

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 31 Oct 2018, 09:52 AM
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. 

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
Daniel
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or