RadSlidingPane is expanded on postback

4 posts, 1 answers
  1. Maria
    Maria avatar
    13 posts
    Member since:
    Jul 2006

    Posted 24 May 2009 Link to this post

    Hello,
    (I posted this thread prevously in the ASP>NET controls by mistake)

    I'm trying to use RadSlidingPane with RadTreeView inside.
    When I click on the tree and it postbacks, the page is reloaded with the pane expanded.
    How can I hide the SlidingPane on postback?

    Here is the structure of my page:

    <telerik:RadSplitter ID="RadSplitter1" runat="server" Skin="Office2007" Width="100%" Height="600px">
     <telerik:RadPane ID="LeftPane" runat="server" style="padding:5px;" >
        <telerik:RadSlidingZone ID="slidingzoneTree" runat="server"  >
            <telerik:RadSlidingPane ID="slidingpaneTree" runat="server" EnableDock="false" Title="Reports" Width="300px" >
                <div style="padding:10px;">        
                    <telerik:RadTreeView ID="treeReports" runat="server"
                        EnableEmbeddedSkins="false" Skin="RsiSkin"
                        onnodeclick="treeReports_NodeClick" >
                    </telerik:RadTreeView>   
                </div>
            </telerik:RadSlidingPane>
        </telerik:RadSlidingZone>    
     </telerik:RadPane>
     <telerik:RadSplitBar ID="RadSplitBar1" runat="server" CollapseMode="Both" />
    <telerik:RadPane ID="RightPane" runat="server" Width="99%" >
         ...................  
    </telerik:RadPane>
    </telerik:RadSplitter>


    Thank you,
    Maria.
  2. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 25 May 2009 Link to this post

    Hello Maria,

    I already answered your other thread and for your convenience I pasted my reply below:

    You are correct about the behavior you describe - this happens because the RadSplitter saves its state and if a RadSlidingpane has been expanded before the postback, it will automatically expand when the page loads again after the postback. What I can suggest in your case is to collapse the RadSlidingPane after the postback through javascript, e.g as shown below:

    <form id="form1" runat="server">  
            <div style="height: 100%">  
                <asp:ScriptManager ID="RadScriptManager1" runat="server">  
                </asp:ScriptManager> 
                <script type="text/javascript">  
                function OnClientLoaded(sender, args)  
                {  
                  var slidingPane = $find("<%=slidingpaneTree.ClientID %>");  
                  if(slidingPane.get_expanded())  
                  {  
                    sender.collapsePane(slidingPane.get_id());  
                  }  
                }  
                  
                </script> 
                <telerik:RadSplitter ID="RadSplitter1" runat="server" Skin="Office2007" Width="100%" 
                    Height="600px">  
                    <telerik:RadPane ID="LeftPane" runat="server" Style="padding: 5px;">  
                        <telerik:RadSlidingZone ID="slidingzoneTree" runat="server" OnClientLoadedOnClientLoaded=OnClientLoaded> 
                            <telerik:RadSlidingPane ID="slidingpaneTree" runat="server"  EnableDock="false" Title="Reports" 
                                Width="300px">  
                                <div style="padding: 10px;">  
                                 <telerik:RadTreeView ID="treeReports" runat="server" OnNodeClick="treeReports_NodeClick">  
                                                                       </telerik:RadTreeView> 
                                     
                                </div> 
                            </telerik:RadSlidingPane> 
                        </telerik:RadSlidingZone> 
                    </telerik:RadPane> 
                    <telerik:RadSplitBar ID="RadSplitBar1" runat="server" CollapseMode="Both" /> 
                    <telerik:RadPane ID="RightPane" runat="server" Width="99%">  
                        ...................  
                    </telerik:RadPane> 
                </telerik:RadSplitter> 
            </div> 
        </form> 

    Of course, if you want you can make this logic more complex in case you want sometimes the RadSlidingPane to be expanded on page load and sometimes not. You can for example use a hidden filed and store a flag parameter there, check it on teh client and determine whether to collapse or not the sliding pane based on the extracted value. However, this is developer's custom logic and you should decide how exactly to implement in order to fit to your particular scenario.

    All the best,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dédé
    Dédé avatar
    60 posts
    Member since:
    May 2009

    Posted 26 May 2009 Link to this post

    Hi,

    I have the same problem with a RadPane that is not collapsed between postbacks. But I think this is due to the fact that my RadSplitter is contained in a MasterPage...

    How can I do to keep the collapsed state across pages using the same MasterPage ?
  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 28 May 2009 Link to this post

    Hello Damien,

    Basically, you should use the same approach - pass some parameter which will determine whether to collapse the pane and collapse it if needed. You can also try the approach provided here which captures the OnClientLoaded event - since the splitter is on the MasterPage, the event will be fired every time you have performed a postback and due to using the ClientID to obtain the zone, it should work for your case.

    In case you need further assistance, please provide more details about the exact setup and why the suggested approach does not work in your case if so.

    All the best,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top