This is a migrated thread and some comments may be shown as answers.

Custom Attribute "Target" for Treeview

5 Answers 101 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 2
Alex asked on 07 Sep 2010, 08:40 PM
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>

5 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 08 Sep 2010, 10:36 AM
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
0
Alex
Top achievements
Rank 2
answered on 08 Sep 2010, 02:40 PM
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.
0
Alex
Top achievements
Rank 2
answered on 08 Sep 2010, 06:43 PM
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);
}
0
Nikolay Tsenkov
Telerik team
answered on 10 Sep 2010, 04:07 PM
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
0
Nikolay Tsenkov
Telerik team
answered on 10 Sep 2010, 04:07 PM
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
Tags
TreeView
Asked by
Alex
Top achievements
Rank 2
Answers by
Nikolay Tsenkov
Telerik team
Alex
Top achievements
Rank 2
Share this question
or