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

RadGrid, fireCommand and MainPanelBar

4 Answers 79 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 11 Dec 2014, 03:24 PM
Greetings,

I have a RadGrid, RadAjaxManager, RadToolbar and RadHtmlChart present on a page.  The RadAjaxManager is configured like so (the ControlIDs are obviously named):

<telerik:RadAjaxManager runat="server" ID="MainAjaxManager" DefaultLoadingPanelID="MainLoadingPanel">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="SurveyGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="SurveyChart" />
                    <telerik:AjaxUpdatedControl ControlID="SurveyGrid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <ClientEvents OnRequestStart="onRequestStart" OnResponseEnd="onResponseEnd" />
    </telerik:RadAjaxManager>

I am trying to update the chart when firing a grid-based custom command from javascript like so:

function onToolBarButtonClicking(sender, e) {
                switch (e.get_item().get_value()) {
                    case 'DataSave':
                        if (isInputValid() == true) {
                            var grd = $find('<%= SurveyGrid.ClientID %>').get_masterTableView();
                            grd.fireCommand('UpdateEdited', '');
                        }
 
                        break;
                    case 'NavCancel':
                        var grd = $find('<%= SurveyGrid.ClientID %>').get_masterTableView();
                        grd.fireCommand('CancelAll', '');
 
                        break;
                    default:
                        break;
                }
            }

Basically, at the time of partial postback, the grid requests its data source, but the chart doesn't.  The chart only requests its data source when the page initially loads.  Perhaps I'm missing something obvious.  I greatly appreciate any suggestions.

4 Answers, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 11 Dec 2014, 03:25 PM
My apologies, the subject should read "RadGrid, fireCommand and RadHtmlChart".
0
Konstantin Dikov
Telerik team
answered on 16 Dec 2014, 09:14 AM
Hello Paul,

Thank you for contacting us.

Can you please elaborate on the exact scenario and especially, how you are binding your RadHtmlChart control. Generally, your RadAjaxManager settings are correct and the RadHtmlChart should be updated when you initiate a postback from the RadGrid.

I am looking forward to your reply.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Paul
Top achievements
Rank 1
answered on 16 Dec 2014, 02:11 PM
Konstantin,

Thanks for the reply.  I am binding using a custom business object as shown below.  My data source is derived from System.Web.UI.DataSourceControl. As I stated earlier, everything works on page load, but subsequent postbacks fail to request data from my data source.  I originally had the chart and data source inside of a RadPanelBar and my AjaxManager was configured accordingly, but the chart failed to update in that scenario as well.

<ans:DataSource runat="server" ID="SurveyDataSource" OnSelectObject="OnSurveySelect" />  <telerik:RadHtmlChart runat="server" ID="SurveyChart" DataSourceID="SurveyDataSource">

The "select" code for my data source is as follows:

protected void OnSurveySelect(object sender, ANS.Web.UI.SelectObjectArgs e)
        {
            try
            {
                var id = <ID GOES HERE>
 
                if (!string.IsNullOrEmpty(id))
                {
                    e.BusinessObject = ANS.Data.Business.Purchases.GetPurchases(id);
                }
            }
            catch (System.Exception ex)
            {
                HandleMessage(ex);
            }
        }
0
Konstantin Dikov
Telerik team
answered on 19 Dec 2014, 09:55 AM
Hello Paul,

Thank you for providing the requested information. 

Now, with the current binding that you have, in order to update the RadHtmlChart after firing the "UpdateEdited" command for the grid, you need to handle that command on server-side and set the new data source to the RadHtmlChart and call its DataBind method.

Please let me know if you need any further assistance on this matter.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Ajax
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or