Possible to have dock listen for content event?

3 posts, 1 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 19 May 2011 Link to this post

    Hi,

    I have a dock with an update panel inside of it. This update panel contains an ASP.NET Microsoft Chart Control. The Chart Control has a Click event handler. I would like to execute code from the dock level after the Chart's Click event handler has finished.

    Currently, I have a 'brute force' method of iterating through all docks on the page in Save Dock Layout and ensuring the state that I want. I would prefer to handle it on a dock-by-dock basis during this parent event handler.

    Is this possible?

    Thanks

    Sean
  2. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 23 May 2011 Link to this post

    Hello Sean,

    As far as I understood you have a Chart user control inside a RadDock, and you want to execute some method (or set a property) on the parent dock, in the user control.
    My suggestion is to get a reference to the parent dock control, in the user control, and execute the desired code. The following method gets a reference to a parent dock control. The parameter passed should be a child control of a RadDock:
    private RadDock GetDock(Control ctrl)
    {
        Control parent = ctrl.Parent;
        while (typeof(RadDock) != parent.GetType())
        {
            parent = parent.Parent;
        }
        RadDock dock = parent as RadDock;
        return dock;
    }

    Greetings,
    Pero
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 21 Jul 2011 Link to this post

    Hi all,

    I recently discover a solution I was happy with in this scenario:

    At the end of my chart's event I call

    RaiseBubbleEvent(sender, e);

    and then in my RadDock which is holding the chart I have:

    /// <summary>
    /// This will fire after the hosted chart's on_click event handler.
    /// Refresh all properties on the RadDock which may have changed
    /// during the on_click event.
    /// </summary>
    /// <returns>Stop bubbling the event up.</returns>
    protected override bool OnBubbleEvent(object source, EventArgs args)
    {
        const bool CANCELEVENT = true;
        Title = string.Format("{0} - {1}", GetChartsReportName(), Chart.Title);
        SerializedChart = Chart.GetAsSerialized();
        return CANCELEVENT;
    }

    where my RadDock is able to respond to events occurring on its content.

    Cheers :)
Back to Top