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

ClientID does not work

2 Answers 68 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
dany7487
Top achievements
Rank 1
dany7487 asked on 06 May 2009, 10:11 PM
Hello, Telerik.
I have upgraded my application to radcontrols for asp.net ajax but now I have found some issues that dont work:
I had these lines that worked before, but not now: (function attached to treeview event: OnClientNodeChecking="TreeViewBeforeClick")

function

 

TreeViewBeforeClick(nodo)

 

{

 

nodo.expand();

 

 

var nodeDIV = document.getElementById(nodo.ClientID);

 

 

var link = nodeDIV.getElementsByTagName("A");

 

...

It does not work because nodo.ClientID is null, however nodo has value.
Can you help?
Thanks,
Daniel.

2 Answers, 1 is accepted

Sort by
0
Accepted
ManniAT
Top achievements
Rank 2
answered on 07 May 2009, 10:53 AM
Hi,

first I would ask you to take a short look at the documentation:
http://www.telerik.com/help/aspnet-ajax/tree_clientonclientnodechecking.html

There you can see that you get two parameters - sender and args.
And args allows you to get access to the node:

var myNode=args.get_node();

node is an object - documented here:
http://www.telerik.com/help/aspnet-ajax/tree_clientradtreenode.html

I don't know WHAT you want to do with the hyperlink you are trying to retrieve in your snippet - but the node object provides methods
like get_navigateUrl or set_navigateUrl.

Regards

Manfred
0
dany7487
Top achievements
Rank 1
answered on 07 May 2009, 02:41 PM
Hi, Manfred.

You were right.
Using get_navigateUrl or set_navigateUrl was the best approach.
Thank you very much for helping me.
Regards,
Daniel.
Tags
Ajax
Asked by
dany7487
Top achievements
Rank 1
Answers by
ManniAT
Top achievements
Rank 2
dany7487
Top achievements
Rank 1
Share this question
or