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

RadDock server side DockPositionChanged does not fire when dropping control in the same position

3 Answers 53 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Hung Leong
Top achievements
Rank 1
Hung Leong asked on 29 Apr 2015, 08:30 PM

I dynamically created raddocks on the server side.

dock.DockPositionChanged += new DockPositionChangedEventHandler(dock_DockPositionChanged);

So I used this line of code to add event handler, however it only gets fired when the control is dropped to another position. It doesn't get fired if I dropped it to the same position.

How do I make it gets fired even if I drop it to the same position. Thanks.

3 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 04 May 2015, 01:27 PM
Hi Hung,

The server-side OnDockPositionChanged event is fired when one of the following changes with the dock are done:
  • A move from one RadDockZone control to another.

  • A move from a RadDockZone control to a floating position.

  • A move from a floating position to a RadDockZone control.

  • A change of index within a RadDockZone control.

More information on the matter is available here - http://docs.telerik.com/devtools/aspnet-ajax/controls/dock/server-side-programming/events/dockpositionchanged

If you want to call a server-side event when a dock is positioned to the same position you can handle the client-side OnClientDockPositionChanged event where you can trigger an AJAX request and execute the server-side logic.​

Regards,
Danail Vasilev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Hung Leong
Top achievements
Rank 1
answered on 04 May 2015, 06:15 PM
What if I could only bind DockPositionChanged event handler on the server as raddocks are created dynamically on the server side. How to achieve this?
0
Danail Vasilev
Telerik team
answered on 07 May 2015, 08:52 AM
Hi Hung,

You can attach to the DockPositionChanged event for a dynamically created dock like that:

ASPX:
<telerik:RadDockZone ID="RadDockZone1" runat="server">
    <telerik:RadDock ID="RadDock1" runat="server">
        <ContentTemplate>
            dock 1
        </ContentTemplate>
    </telerik:RadDock>
</telerik:RadDockZone>
<asp:Label ID="Label1" Text="" runat="server" />
C#:
protected void Page_Load(object sender, EventArgs e)
{
    RadDock rd1 = new RadDock();
    rd1.AutoPostBack = true;
    rd1.ID = "dock2";
    rd1.DockPositionChanged += new DockPositionChangedEventHandler(RadDock1_DockPositionChanged);
    RadDockZone1.Controls.Add(rd1);
 
}
protected void RadDock1_DockPositionChanged(object sender, DockPositionChangedEventArgs e)
{
    Label1.Text = DateTime.Now.ToString();
}

Note that this is a server-side event, so in order for it to be fired you should set the AutoPostBack property of the dock to true.

Regards,
Danail Vasilev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Dock
Asked by
Hung Leong
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Hung Leong
Top achievements
Rank 1
Share this question
or