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

DockPositionChanged event handler for programmatically created RadDock

3 Answers 131 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Richard M
Top achievements
Rank 1
Richard M asked on 15 Dec 2010, 03:05 AM
How do I create and trigger an Event Handler for a programatically created RadDock when I change it's position inside of a RadDockZone?

3 Answers, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 15 Dec 2010, 02:10 PM
Hi Richard,

To achieve the desired scenario you should handle the RadDock's DockPositionChanged server-side event, and set its AutoPostBack property to true. Please note that, for the event to be fired you need to attach the handler on every post-back in the Page.Init event.
For your convenience I have created a sample project that dynamically creates a dock and attaches the DockPositionedChanged event. Here is the full source code:
.aspx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="RadScriptManager1" runat="server">
    </asp:ScriptManager>
    <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
        <telerik:RadDockZone ID="RadDockZone1" runat="server" MinHeight="300px" Width="300px">
            <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock-Title" Width="300px"
                Height="300px">
                <ContentTemplate>
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut eu leo quis felis eleifend
                    congue id ac nulla. Suspendisse in sapien eu tortor aliquam luctus. Suspendisse
                    pretium, nulla sit amet porttitor lobortis, ante sapien blandit ante, et tempor
                    magna eros nec sapien. In hac habitasse platea dictumst. Nullam a quam lorem, eu
                    vestibulum turpis. Praesent a neque et diam tincidunt suscipit ut semper massa.
                    Vivamus posuere, mi eu consectetur consequat, libero risus accumsan erat, ut facilisis
                    dolor justo a enim. Donec suscipit tincidunt lorem, sed aliquam velit pulvinar euismod.
                    Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus
                    mus.
                </ContentTemplate>
            </telerik:RadDock>
        </telerik:RadDockZone>
    </telerik:RadDockLayout>
    </form>
</body>
</html>

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Drawing;
 
public partial class Default : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
        RadDock dock = new RadDock();
        dock.ID = "RadDock2";
        dock.AutoPostBack = true;
        dock.DockPositionChanged += new DockPositionChangedEventHandler(dock_DockPositionChanged);
 
        RadDockLayout1.Controls.Add(dock);
        dock.DockZoneID = RadDockZone1.ClientID;
    }
 
    protected void dock_DockPositionChanged(object sender, DockPositionChangedEventArgs e)
    {
        RadDock dock = sender as RadDock;
        dock.Text = "The RadDock was moved at: " + DateTime.Now.ToString();
    }
}

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
Richard M
Top achievements
Rank 1
answered on 15 Dec 2010, 05:10 PM
That's exactly what I needed.  Thank you very much.
0
Brian Lanham
Top achievements
Rank 1
answered on 10 Feb 2011, 02:45 AM
Thank you!  Reattaching in Page_Init is what I was missing!
Tags
Dock
Asked by
Richard M
Top achievements
Rank 1
Answers by
Pero
Telerik team
Richard M
Top achievements
Rank 1
Brian Lanham
Top achievements
Rank 1
Share this question
or