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

How to get Attribute "DataFieldID"?

2 Answers 139 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
BiBongNet
Top achievements
Rank 2
BiBongNet asked on 06 Oct 2012, 04:40 AM
I have a TreeView like this:

<telerik:RadTreeView ID="TreeView" runat="server" DataTextField="Title" DataFieldID="CategoryID" DataValueField="ContentTypeID" DataFieldParentID="ParentID"></telerik:RadTreeView>

I would like to get the value of CategoryID on client side, so I try to get the attribute of DataFieldID, but can't find a way to.

I have tried:
treeNode.get_attributes().getAttribute("DataFieldID");

but that returns undefined.

This page http://www.telerik.com/help/aspnet-ajax/treeview-client-objects-radtreenode.html shows many attributes that their value can be retrieved with methods, like:
get_navigateUrl();
get_imageUrl();
get_toolTip();
...
but there is nothing for DataFieldID.

I CAN get the value of CategoryID by creating a custom attribute ("CategoryIDCustom" for example), then get by treeNode.get_attributes().getAttribute("CategoryIDCustom");
But I think why do we need to create a custom attribute, while there is ALREADY one for it?

Now, I am living with the way of creating a custom attribute.

Is there a different way to get that? or am I missing something? Please help.
Thank you.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Oct 2012, 05:31 AM
Hello,

Unfortunately this property can not be used on the client-side since it is used internally by RadTreeView to create a hierarchy. Please take a look at the following forum post where this issue is being fully discussed. 

Hope this helps.

Regards,
Shinu.
0
BiBongNet
Top achievements
Rank 2
answered on 06 Oct 2012, 06:53 AM
Thank you for your reply.
So, I should be "happy" with my way now.
Tags
TreeView
Asked by
BiBongNet
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
BiBongNet
Top achievements
Rank 2
Share this question
or