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

RadDock SaveLayout

3 Answers 84 Views
Dock
This is a migrated thread and some comments may be shown as answers.
A.mass
Top achievements
Rank 1
A.mass asked on 11 May 2009, 10:24 AM



Hello everyone,

My problem is that RadDockLayout_SaveDockLayout is processed when any event on the page is fired.
I want the code in RadDockLayout_SaveDockLayoutto be executed only when a raddock position change.



Best Regards,



3 Answers, 1 is accepted

Sort by
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 11 May 2009, 11:29 AM
You could use a flag which will be changed in DockPositionChanged handler, e.g.
bool isDockPositionChanged = false;  
...  
protected void RadDock1_DockPositionChanged(object sender, DockPositionChangedEventArgs e)  
{  
    isDockPositionChanged= true;  
}  
....  
protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)   
{  
     if(isDockPositionChanged== true)  
        {  
            ...SaveState here  
        }  


0
A.mass
Top achievements
Rank 1
answered on 11 May 2009, 05:06 PM



Hello Obi-Wan Kenobi,

Thanks a lot for your fast reply.
But the problem that event RadDock1_DockPositionChanged is processed when any event on the page is fired just like the SaveLayout.


Your help is highly appreciated.

0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 12 May 2009, 11:34 AM
DockPositionChanged event is fired only when a RadDock is changed its original position.
The code below illustrates that if the RadDocks are not moved and click on a button("Postback"), the DockPositionChanged event will not be fired.
ASPX:
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <div> 
    <telerik:RadDockLayout ID="RadDockLayout1" runat="server" Skin="Vista" > 
                    <telerik:RadDockZone ID="RadDockZone1" runat="server" Width="300px">  
                        <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock1" OnDockPositionChanged="DockPositionChanged"></telerik:RadDock> 
                         <telerik:RadDock ID="RadDock2" runat="server" Title="RadDock2" OnDockPositionChanged="DockPositionChanged"></telerik:RadDock> 
                    </telerik:RadDockZone> 
                    <telerik:RadDockZone ID="RadDockZone2" runat="server" Width="300px"></telerik:RadDockZone> 
     </telerik:RadDockLayout> 
     <asp:Label ID="Label1" runat="server"></asp:Label>    
     <asp:Button ID="Button1" runat="server" Text="Postback"/>  
    </div> 
    </form> 
</body> 
</html> 
 
Codebehind:
protected void DockPositionChanged(object sender, EventArgs e)  
    {  
        Label1.Text += ((RadDock)sender).ID;  
    } 

Tags
Dock
Asked by
A.mass
Top achievements
Rank 1
Answers by
Obi-Wan Kenobi
Top achievements
Rank 1
A.mass
Top achievements
Rank 1
Share this question
or