Custom Attribute "Target" for Treeview

6 posts, 0 answers
  1. Alex
    Alex avatar
    31 posts
    Member since:
    Jun 2009

    Posted 07 Sep 2010 Link to this post

    I have a web service based treeview set up and basically what I'm aiming to do is give the node a target. The set up is that this treeview is in a left frame, and the nodes are images that will be loaded in the right hand frame. I'm running this through a web service and the RadTreeNodeData class doesn't have the "Target" attribute like the RadTreeNode variable does. Is there a way to have a target on the nodes? I've given my code below and after searching around, it's all that I've found. Let me know if I'm doing something incorrectly, thanks

    <
    telerik:RadTreeView EnableViewState="true" ID="treeImages" runat="server"
     DataFieldID="Id" DataFieldParentID="ParentId" DataTextField="Text"
     DataValueField="Value" DataNavigateUrlField="NavigateURL" OnClientNodeDataBound="OnClientNodeDataBoundHandler">
      <WebServiceSettings Path="FolderTree.aspx" Method="LoadPromotionNodes" />
        <DataBindings>
          <telerik:RadTreeNodeBinding Expanded="false" />
        </DataBindings>
    </telerik:RadTreeView>
    for (int row = 0; row < rowMax; row++)
    {
        returnNode.Text = _returnArray[row, 0];
        returnNode.Value = _returnArray[row, 1];
        returnNode.Attributes["Target"] = "fraRightFrame";
        returnNode.ExpandMode = TreeNodeExpandMode.WebService;
        returnNode.NavigateUrl = "images.aspx?loc=" + _returnArray[row, 1];                
        result.Add(returnNode);
    }
    return result.ToArray();

    <script type="text/javascript">
        function OnClientNodeDataBoundHandler(sender, e) {
            var node = e.get_node();
            var target = node.get_attributes().getAttribute("Target");
            node.get_attributes().setAttribute("Target", target);
        }
    </script>
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 08 Sep 2010 Link to this post

    Hi Alex,

    Well, using a WebService, this should be it.
    Actually, you don't mention if the code below is working for you. Could you, please, specify that? And if it's not working - what exactly seems to be the problem?

    Hope that soon your problem will be resolved!


    Regards,
    Nikolay Tsenkov
    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. Alex
    Alex avatar
    31 posts
    Member since:
    Jun 2009

    Posted 08 Sep 2010 Link to this post

    It's actually not working, and through a bunch of research that I've done it's the way to do it. I alert the attribute and it pops up correctly with the "target", in this case a frame, but it still shows in the frame that the treeview is in. Let me know if you have any other suggestions.
  4. Alex
    Alex avatar
    31 posts
    Member since:
    Jun 2009

    Posted 08 Sep 2010 Link to this post

    I solved it by using the set_target() variable as shown below. I didn't find it until I looked at an older class list for the rad tree node.
    function OnClientNodeDataBoundHandler(sender, e) {
        var node = e.get_node();
        var target = node.get_attributes().getAttribute("Target");
        node.set_target(target);
    }
  5. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 10 Sep 2010 Link to this post

    Hi Alex,

    Glad that you solved it!
    And sorry that I forgot about this function!

    Hope you will not experience any more hard time with our controls!
    Of course, we will be happy to help if you have problems implementing something  else!


    Regards,
    Nikolay Tsenkov
    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
  6. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 10 Sep 2010 Link to this post

    Hi Alex,

    Glad that you solved it!
    And sorry that I forgot about this function!

    Hope you will not experience any more hard time with our controls!
    Of course, we will be happy to help if you have problems implementing something  else!


    Regards,
    Nikolay Tsenkov
    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
Back to Top