To give a little background, I have a RadSplitter set up with two panes - one for a RadTreeView and the other for "external content" (using URLs, but they are all internal to the site). The nodes in the tree are setup like this:
The entire TreeView object is setup as an AjaxUpdatedControl which, combined with the Javascript "node.showLoadingStatus()" method (in lieu of a LoadingPanel covering the entire tree), allows the nodes that are configured as ServerSide to appear to behave identically to the ServerSideCallback expanding nodes. This is setup as so:
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" EnableAJAX="true"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="trProjects"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="trProjects" /> <telerik:AjaxUpdatedControl ControlID="hvNodeToSelect" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> <ClientEvents OnResponseEnd="ajaxCallback" /> </telerik:RadAjaxManager>When a certain action occurs on the main RadPane (where the "external" content is at - internal pages so XSS is not an issue) the loaded page calls a function called "selectNode" on the parent (which contains the RadSplitter, TreeView, etc.) which looks like this:
//called from child pages to select the associated node function selectNode(parent, child) { var parentNode = treeView.findNodeByValue(parent); setNodeToSelect(child); if (!parentNode.get_expanded()) { if (!parentNode.get_parent().get_expanded()) parentNode.get_parent().expand(); parentNode.expand(); } else { if (parentNode.get_expandMode() != 1) { //Server-side (encapsulated by RadAJAX) var childNode = treeView.findNodeByValue(child); childNode.set_selected(true); nodeToSelect = null; //page-level javascript variable } } }The first thing it does is check to see if the parent node is expanded (all the way through the top-level root node) and expands down. For the purposes of this issue this is the block being called and not the other half (the "else" clause). When I execute the action that fires this the bottom-level child node (one of the database-driven X nodes as referenced above, the parent being the one with the ServerSideCallback expand mode) gets selected which is exactly what I want.
What I've noticed though is once I've utilized the "parentNode.expand();" method on a node that is ServerSide (which the RadAjaxManager makes appear as if no postback occurs) this functionality stops working. To better explain this, inside the method above there is a small function called setNodeToSelect called right at the beginning which looks like this:
function setNodeToSelect(value) { nodeToSelect = value; hvNodeToSelect.value = nodeToSelect; } function trProjects_NodePopulated(sender, args) { var node = args.get_node(); if (nodeToSelect != null) { treeView.findNodeByValue(nodeToSelect).set_selected(true); nodeToSelect = null; } } this.get_element().value=d_registerSelectedNode:function(d){this._insertSortedHierarchicalIndexInArray(d._getHierarchicalIndex(),this._clientState.selectedNodes);<Windows> <telerik:RadWindow ID="GLLookupWindow" runat="server" Behaviors="Close" Width="900" Height="700" OnClientClose="UnhideIframe_OnClientClose"> <ContentTemplate> <asp:Panel runat="server" ID="pnlGLLookup" Visible="true" TabIndex="-1"> <telerik:RadGrid AutoGenerateColumns="False" ID="GLLookup" OnItemCommand ="GLLookup_ItemCommand" AllowFilteringByColumn="true" OnItemCreated="GLLookup_ItemCreated" DataSourceID="SqlDataSourceGLLookupwindow" AllowSorting="true" runat="server" PagerStyle-AlwaysVisible="true" AllowPaging="true" PageSize ="20" > <GroupingSettings CaseSensitive="false" /> <MasterTableView DataKeyNames="GCMGRP,GCACCT,GCSACT,GCDEPT,GCDESC" > <PagerStyle Mode="NumericPages" PageButtonCount="5" /> <Columns> <telerik:GridBoundColumn HeaderText="Major" DataField="GCMGRP" UniqueName="GCMGRP" AllowFiltering="true" SortExpression="GCMGRP" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Bottom" /> <telerik:GridBoundColumn HeaderText="Acct" DataField="GCACCT" UniqueName="GCACCT" AllowFiltering="true" SortExpression="GCACCT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Bottom" /> <telerik:GridBoundColumn HeaderText="Sub" DataField="GCSACT" UniqueName="GCSACT" AllowFiltering="true" SortExpression="GCSACT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Bottom" /> <telerik:GridBoundColumn HeaderText="Dept/Loc" DataField="GCDEPT" UniqueName="GCDEPT" AllowFiltering="true" SortExpression="GCDEPT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Bottom" /> <telerik:GridBoundColumn HeaderText="Description" DataField="GCDESC" UniqueName="GCDESC" AllowFiltering="true" SortExpression="GCDESC" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Bottom" /> </Columns> <ItemStyle Wrap="false" /> <PagerStyle Mode="NumericPages" AlwaysVisible="true"></PagerStyle> </MasterTableView> <ClientSettings EnablePostBackOnRowClick="true" > </ClientSettings> </telerik:RadGrid> </asp:Panel> </ContentTemplate> </telerik:RadWindow></Windows><script type="text/javascript"> function spellCheck() { var spell = $find('<%= splContractSpellCheck.ClientID %>'); spell.startSpellCheck(); } </script> <asp:Button ID="btnContractSpellCheck" runat="server" Text="Spell Check" CssClass="buttonStyle" CausesValidation="False" UseSubmitBehavior="False" OnClientClick="javascript: spellCheck()" /> <telerik:RadSpell ID="splContractSpellCheck" runat="server" ControlsToCheck="txtContractSummary,txtContractPurpose,txtContractComments" ButtonType="None" /> <asp:TextBox ID="txtContractSummary" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="34px" Enabled="false" /> <asp:TextBox ID="txtContractPurpose" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="86px" Enabled="false" /> <asp:TextBox ID="txtContractComments" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="52px" Enabled="false" />function onCheckBoxClick(chk) {
debugger;
if (chkText == "Toggle ToolBar") {
var splitter = $find("<%= MainSplitter.ClientID %>");
var pane = splitter.getPaneById("TopPane");
var isCollapseSuccess = pane.collapse();
}
}
</script>
</telerik:RadCodeBlock>
HTML Code:
<telerik:RadSplitter ID="MainSplitter" runat="server" Height="100%" Width="100%"
Orientation="Horizontal">
<telerik:RadPane ID="TopPane" runat="server" Height="100" Scrolling="none" >
<!-- Place the content of the pane here -->
tree.SelectedNodes.Clear();RadTreeNode node = tree.FindNodeByValue(idtema.ToString());if (node != null){ node.Selected = true;}***in my page **** if (!IsPostBack) { GetTelerikWindow( placeholder ); } **** In library ************* public static void GetTelerikWindow( PlaceHolder ph , string WindowId, string windowname, int height, int width, Boolean autosize) { RadWindowManager TWindowMgr = new RadWindowManager(); TWindowMgr.ID="Manager_"+WindowId; TWindowMgr.EnableShadow = true; RadWindow TWindow = new RadWindow(); TWindow.ID=WindowId; TWindow.Title=windowname; TWindow.ShowContentDuringLoad=false ; TWindow.Width=width; TWindow.Height=height; TWindow.VisibleStatusbar=false; TWindow.Modal = true; TWindow.AutoSize = autosize; TWindow.KeepInScreenBounds = true; TWindow.Skin = "WebBlue"; TWindowMgr.Controls.Add(TWindow); ph.Controls.Add(TWindowMgr); }