RadDock SaveLayout

4 posts, 0 answers
  1. A.mass
    A.mass avatar
    30 posts
    Member since:
    Apr 2009

    Posted 11 May 2009 Link to this post




    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,



  2. Obi-Wan Kenobi
    Obi-Wan Kenobi  avatar
    460 posts
    Member since:
    Aug 2007

    Posted 11 May 2009 Link to this post

    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  
            }  


  3. A.mass
    A.mass avatar
    30 posts
    Member since:
    Apr 2009

    Posted 11 May 2009 Link to this post




    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.

  4. Obi-Wan Kenobi
    Obi-Wan Kenobi  avatar
    460 posts
    Member since:
    Aug 2007

    Posted 12 May 2009 Link to this post

    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;  
        } 

Back to Top