how to expand and select tree node by calling webservice explicitly

1 posts, 0 answers
  1. sanam
    sanam avatar
    1 posts
    Member since:
    Jul 2017

    Posted 22 Jul 2017 Link to this post


    We have a Tree view and  clicking  "+"  uses the web service . How to call the web service explicitly  to expand that node and get it selected .

    <telerik:RadTreeView ID="RadTreeViewBottom" runat="server" PersistLoadOnDemandNodes="false" RegisterWithScriptManager="true" 
            LoadingStatusPosition="None" OnClientNodeClicked="RadTreeViewBottom_ClientNodeClicked"
            OnClientKeyPressing="RadTreeViewBottom_ClientKeyPressing" EnableViewState="false"
            OnClientNodeDataBound="NodeDataBound" OnClientNodeExpanded="Expanded"
            Style="white-space: normal;">
            <WebServiceSettings Method="ViewerBottom_GetNodesChildren" Path="~/ScriptServices/ScriptService.asmx" />
                <telerik:RadTreeNode Text="ExistingNode" Visible="True"/>



    Below one is the Webmethod which i use to call in the web service

            public RadTreeNodeData[] ViewerBottom_GetNodesChildren(RadTreeNodeData node, object context)
                IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context;

                int topID = int.Parse(contextDictionary["TopID"].ToString());
                string type = contextDictionary["Type"].ToString();
                int parentID = 0;

                if (node != null)
                    parentID = int.Parse(node.Value);
                object[] parms = new object[3];
                parms[0] = (int)topID;
                parms[1] = type;
                parms[2] = parentID;

                global::Viewer.ViewerService.Outline outline = (ViewerService.Outline)Data.WebServiceDataProvider.GetData(Data.ViewerClientServiceWrapper.MethodName.getOutline, parms);

                ViewerService.OutlineItem[] outlineItems = outline.ChildItems;

                List<RadTreeNodeData> result = new List<RadTreeNodeData>();

                foreach (ViewerService.OutlineItem item in outlineItems)
                    RadTreeNodeData nodeData = new RadTreeNodeData();

                    nodeData.Text = item.Title;
                    nodeData.Value = item.Id.ToString();
                    nodeData.Attributes.Add("DocID", item.DocumentId);

                    if (item.HasChildren)
                        nodeData.ExpandMode = TreeNodeExpandMode.WebService;

                return result.ToArray();


    Below is my JS 1183 is parent node and 1185 is the child node.

    var node1 = parentNode.findNodeByValue("1183");
                           if (node1 == null)
                           else {
                               var node2 = parentNode.findNodeByValue("1185");
                               if (node2 != null) {

    in JS here node2 returns me null i think  because I'm not able to Call the Webservice ecplicitly can anyone suggest me ? how to call it programatically .




Back to Top