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

Possible to have dock listen for content event?

2 Answers 35 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 2
Sean asked on 19 May 2011, 07:35 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 23 May 2011, 02:32 PM
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.

0
Sean
Top achievements
Rank 2
answered on 21 Jul 2011, 06:17 PM
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 :)
Tags
Dock
Asked by
Sean
Top achievements
Rank 2
Answers by
Pero
Telerik team
Sean
Top achievements
Rank 2
Share this question
or