+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Treeview select state is not changing

Treeview select state is not changing

6 posts, 0 answered
  1. Ian
    Ian avatar
    5 posts
    Registered:
    27 Jul 2010
    23 Aug 2010
    Link to this post
    I have a page group consisting of 3 pages. I have placed a site treeview control on the page (sitefinity_usercontrols_navigation35_sitetreeview_ascx) with the follow properties set:
    showStartingNode = False
    startFromCurrentNode = True
    StartingNodeOffset = -1

    This then shows all the pages in the page group, however when I click and go to the 2nd page in the group the rtSelected class is on the 1st page in the group even when I am viewing the 2nd.

    Please can you help me fix this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Aug 2010
    Link to this post
    Hello Ian,

    You can add the following js code in SiteTreeView.ascx

    function pageLoad() {
           var tree = $find("<%= RadTreeview1.ClientID %>");
           if (tree) {
               var location = window.location.pathname;
               location = location.substring(location.lastIndexOf('/') + 1);
               var nodeText = location.split('.');
               var currentNode = tree.findNodeByText(nodeText[0]);
               if (currentNode) {
                   currentNode.set_selected(true);
                   
               }
     
           }



    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Ian
    Ian avatar
    5 posts
    Registered:
    27 Jul 2010
    24 Aug 2010
    Link to this post
    Hi,

    Thanks for you quick rersponse, is there a server side fix for this?

    Cheers Ian
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Aug 2010
    Link to this post
    Hello Ian,

    You can add the code below inside OnDataBound

    public void RadTreeview1_Bound(object o, EventArgs e)
      {
          var n = SiteMap.CurrentNode as CmsSiteMapNode;
          if (n != null && n.Parent.PageType == CmsPageType.Group)
          {
              RadTreeNode rtn = RadTreeview1.FindNodeByText(n.Title);
              if (rtn != null)
              {
                  rtn.Selected = true;
              }
          }
     
      }


    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Ian
    Ian avatar
    5 posts
    Registered:
    27 Jul 2010
    24 Aug 2010
    Link to this post
    Thanks Ivan,

    Could elaborate a bit more as I am not a .net developer

    Thanks Ian
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Aug 2010
    Link to this post
    Hello Ian,

    Please take a look at RadTreeView for ASP.NET AJAX

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
6 posts, 0 answered