RadGrid, fireCommand and MainPanelBar

5 posts, 0 answers
  1. Paul
    Paul avatar
    14 posts
    Member since:
    Sep 2011

    Posted 11 Dec 2014 Link to this post

    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.

  2. Paul
    Paul avatar
    14 posts
    Member since:
    Sep 2011

    Posted 11 Dec 2014 in reply to Paul Link to this post

    My apologies, the subject should read "RadGrid, fireCommand and RadHtmlChart".
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1795 posts

    Posted 16 Dec 2014 Link to this post

    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.

     
  5. Paul
    Paul avatar
    14 posts
    Member since:
    Sep 2011

    Posted 16 Dec 2014 in reply to Konstantin Dikov Link to this post

    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);
                }
            }
  6. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1795 posts

    Posted 19 Dec 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017