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

RadSlidingPane is expanded on postback

3 Answers 200 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Maria
Top achievements
Rank 1
Maria asked on 24 May 2009, 08:09 AM
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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 25 May 2009, 10:03 AM
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.
0
Dédé
Top achievements
Rank 1
answered on 26 May 2009, 07:21 AM
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 ?
0
Svetlina Anati
Telerik team
answered on 28 May 2009, 01:39 PM
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.
Tags
Splitter
Asked by
Maria
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Dédé
Top achievements
Rank 1
Share this question
or