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

Find DataFieldId from RadTreeView through JS

2 Answers 204 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kaushal
Top achievements
Rank 1
Kaushal asked on 13 May 2011, 09:17 AM
Hello,

Here I need to find DataFieldId from RadTreeView through javascript. My scenario as under:

RadTreeView Fillup as:

RadTreeView1.DataTextField = "ModuleName";
RadTreeView1.DataFieldID = "ModuleID";
RadTreeView1.DataValueField = "URL";
RadTreeView1.DataFieldParentID = "ParentModuleID";
RadTreeView1.DataSource = lstmenu;
RadTreeView1.DataBind();

As above I need DataTextField to display text of my modules, DataValueFields which i am using in JS to pass local url in it. In DatafieldId I am storing "ModuleId". But in javascript I can not find DataFieldId which I need to user on click of RadTreeNode.

JS as like:

function onNodeClicking(sender, args) {
    if (args.get_node().get_value() != null) {
        //window.open(args.get_node().get_value(), args.get_node().get_text(), 'resizable=yes')
    }
}

in above js I need to find DataFieldId also. Please assit me how to do this.

Thanks & Regards,

Kaushal Jani

2 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 18 May 2011, 12:45 PM
Hello Kaushal,

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

Best wishes,
Kate
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Kaushal
Top achievements
Rank 1
answered on 19 May 2011, 06:12 AM
Hi Kate,

Thanks for reply me first of all.
Here after lot of my searching and finally from your answer I got that this property is not accessible at client side.

I also found one alternate solution related to it.Here it is:
I am passing my ModuleId at the time of I am passing value into RadTreeView:

 protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
    {
        e.Node.ToolTip = "MyTootip";
        e.Node.Value = e.Node.Value + "?ModuleID=" + ModuleID.ToString();
    }

Now I can use this parameter in each page as request querystring. Also I can bind Tooltip here is you want (It also can bind client side).
Thanks Kate for all of this and for co-operation,

Regards,
Kaushal Jani

Tags
TreeView
Asked by
Kaushal
Top achievements
Rank 1
Answers by
Kate
Telerik team
Kaushal
Top achievements
Rank 1
Share this question
or