Please run the following code:
Test.aspx
Test.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<!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 runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<p> |
<input type="button" onclick="showSplitterClientState();" value="Show current splitter client state" /> |
<input type="button" onclick="showSplitBarClientState();" value="Show current splitbar client state" /></p> |
<p> |
<b>Server side state: </b><asp:Literal ID="litServerSideInfo" runat="server" /></p> |
<div> |
<asp:ScriptManager ID="smScriptManager" runat="server" /> |
<telerik:RadAjaxManager ID="AjaxManager" runat="server" EnablePageHeadUpdate="False" EnableHistory="true"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="btnLeftMenu1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="rspSplitter" /> |
<telerik:AjaxUpdatedControl ControlID="litServerSideInfo" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="btnLeftMenu2"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="rspSplitter" /> |
<telerik:AjaxUpdatedControl ControlID="litServerSideInfo" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:RadSplitter ID="rspSplitter" runat="server"> |
<telerik:RadPane ID="rpLeftMenuPane" runat="server" BackColor="AliceBlue"> |
<asp:Button ID="btnLeftMenu1" Text="Left menu1" OnClientClick="hideSubMenuPane();" OnClick="btnLeftMenu1_Click" runat="server" /><br /> |
<asp:Button ID="btnLeftMenu2" Text="Left menu2" OnClientClick="showSubMenuPane();" OnClick="btnLeftMenu2_Click" runat="server" /> |
</telerik:RadPane> |
<telerik:RadPane ID="rpLeftSubMenuPane" OnClientCollapsed="leftSubMenuPaneCollapsed" OnClientBeforeExpand="leftSubMenuPaneExpand" runat="server" BackColor="Gold"> |
<asp:Button ID="btnLeftSubMenu" Text="Left sub menu" OnClick="btnLeftSubMenu_Click" runat="server" /> |
</telerik:RadPane> |
<telerik:RadSplitBar ID="rsbSplitBar" runat="server" CollapseExpandPaneText="Expand/Collapse" /> |
<telerik:RadPane ID="rpContentPane" runat="server" BackColor="BurlyWood"> |
<asp:Label ID="lblContent" Text="Content" runat="server" /> |
</telerik:RadPane> |
</telerik:RadSplitter> |
</div> |
</form> |
<script type="text/javascript"> |
function showSplitterClientState() |
{ |
var splitter = $find('<%= rspSplitter.ClientID%>'); |
if (splitter != null) |
{ |
var leftMenuPane = splitter.getPaneById('<%= rpLeftMenuPane.ClientID%>'); |
var leftSubMenuPane = splitter.getPaneById('<%= rpLeftSubMenuPane.ClientID%>'); |
var contentPane = splitter.getPaneById('<%= rpContentPane.ClientID%>'); |
var rsbSplitBar = $find('<%= rsbSplitBar.ClientID%>'); |
if (rsbSplitBar != null) |
{ |
//alert("Collapse Mode: " + rsbSplitBar.get_collapseMode()); |
} |
alert("LeftMenuPane collapsed: " + leftMenuPane.get_collapsed() |
+ "\nLeftSubMenuPane collapsed: " + leftSubMenuPane.get_collapsed() |
+ "\nContentPane collapsed: " + contentPane.get_collapsed()); |
} |
} |
function showSplitBarClientState() |
{ |
var splitBar = $find('<%= rsbSplitBar.ClientID%>'); |
if (splitBar != null) |
{ |
var prevPane = splitBar.get_prevPane(); |
var nextPane = splitBar.get_nextPane(); |
alert("Collapse Mode: " + splitBar.get_collapseMode() |
+ "\nprevPane is collapsed? " + splitBar.isCollapsed(1) |
+ "\nnextPane is collapsed? " + splitBar.isCollapsed(2)); |
} |
} |
function hideSubMenuPane() |
{ |
var splitter = $find('<%= rspSplitter.ClientID%>'); |
if (splitter != null) |
{ |
var leftMenuPane = splitter.getPaneById('<%= rpLeftMenuPane.ClientID%>'); |
var leftSubMenuPane = splitter.getPaneById('<%= rpLeftSubMenuPane.ClientID%>'); |
var contentPane = splitter.getPaneById('<%= rpContentPane.ClientID%>'); |
leftSubMenuPane.collapse(); |
contentPane.expand(); |
showSplitterClientState(); |
} |
} |
function showSubMenuPane() |
{ |
var splitter = $find('<%= rspSplitter.ClientID%>'); |
if (splitter != null) |
{ |
var leftMenuPane = splitter.getPaneById('<%= rpLeftMenuPane.ClientID%>'); |
var leftSubMenuPane = splitter.getPaneById('<%= rpLeftSubMenuPane.ClientID%>'); |
var contentPane = splitter.getPaneById('<%= rpContentPane.ClientID%>'); |
leftSubMenuPane.expand(); |
contentPane.expand(); |
showSplitterClientState(); |
} |
} |
function leftSubMenuPaneCollapsed(pane) |
{ |
alert(pane.get_id() + ": collapsed"); |
} |
function leftSubMenuPaneExpand(pane) |
{ |
alert(pane.get_id() + ": expanded"); |
} |
</script> |
</body> |
</html> |
Test.aspx.cs
using System; |
using System.Web.UI.WebControls; |
public partial class Test : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
btnLeftMenu1.Text = "Left menu 1"; |
btnLeftMenu2.Text = "Left menu 2"; |
btnLeftSubMenu.Text = "Left sub menu"; |
lblContent.Text = "Content"; |
InitializeSplitter(); |
} |
protected void btnLeftMenu1_Click(object sender, EventArgs e) |
{ |
lblContent.Text += " - updated by left menu 1"; |
btnLeftSubMenu.Text += " - 1"; |
rpLeftSubMenuPane.Collapsed = true; |
rpContentPane.Collapsed = false; |
ShowServerSideInfo(); |
} |
protected void btnLeftMenu2_Click(object sender, EventArgs e) |
{ |
lblContent.Text += " - updated by left menu 2"; |
btnLeftSubMenu.Text += " - 2"; |
rpLeftSubMenuPane.Collapsed = false; |
rpContentPane.Collapsed = false; |
ShowServerSideInfo(); |
} |
protected void btnLeftSubMenu_Click(object sender, EventArgs e) |
{ |
lblContent.Text += " - updated by left sub menu"; |
} |
private void InitializeSplitter() |
{ |
rspSplitter.Width = new Unit(100, UnitType.Percentage); |
rspSplitter.Height = new Unit(100, UnitType.Percentage); |
rspSplitter.ResizeMode = Telerik.Web.UI.SplitterResizeMode.Proportional; |
rpLeftMenuPane.Width = new Unit(120, UnitType.Pixel); |
rpLeftMenuPane.Height = new Unit(100, UnitType.Percentage); |
rpLeftMenuPane.MinWidth = 120; |
rpLeftMenuPane.Scrolling = Telerik.Web.UI.SplitterPaneScrolling.None; |
rpLeftMenuPane.Collapsed = false; |
rpLeftSubMenuPane.Width = new Unit(200, UnitType.Pixel); |
rpLeftSubMenuPane.Height = new Unit(100, UnitType.Percentage); |
rpLeftSubMenuPane.MinWidth = 200; |
rpLeftSubMenuPane.Scrolling = Telerik.Web.UI.SplitterPaneScrolling.Both; |
rpLeftSubMenuPane.Collapsed = false; |
rsbSplitBar.EnableViewState = true; |
rsbSplitBar.CollapseMode = Telerik.Web.UI.SplitBarCollapseMode.Both; |
rpContentPane.Width = new Unit(300, UnitType.Pixel); |
rpContentPane.Height = new Unit(100, UnitType.Pixel); |
rpContentPane.MinWidth = 200; |
rpContentPane.Scrolling = Telerik.Web.UI.SplitterPaneScrolling.Y; |
rpContentPane.Collapsed = false; |
} |
private void ShowServerSideInfo() |
{ |
litServerSideInfo.Text = "" |
+ "LeftMenuPane collapsed = " + rpLeftMenuPane.Collapsed + "<br />" |
+ "LeftSubMenuPane collapsed = " + rpLeftSubMenuPane.Collapsed + "<br />" |
+ "ContentPane collapsed = " + rpContentPane.Collapsed; |
} |
} |
Please do the following steps when you open this test page:
- Click the "Show current splitter client state" button. You will get an alert message that tells you the expected value.
- Click the "Show current splitbar client state" button. You will get an alert message that tells you the expected value.
- Click "Left menu 1". The middle pane is collapsed. "Server side state" will tell you the server-side value.
- Do step1 and step2 again to check the client side value. You will get all expected values as well. So far so good...
- Click "Left menu 3". The middle pane is expanded. "Server side state" will tell you the server-side value.
- Click the "Show current splitter client state" button to check the client side values. You will get WRONG value from for the middle pane collpase value (it's true, which it should be false).
- Click the "Show current splitbar client state" button. You will get the expected value (false) of the middle pane's collapse status.
- You will also see the values from "Server side state" are right.
- Now you will be failed to collapse the middle pane.
Therefore, I doubt if the client side function "pane.get_collapsed()" doesn't work well. Becasue of the wrong status of the middle pane, you cannot collpase it.
Any comments will be helpful.
Cheers
Alan