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

Question regarding OnClientNodeClicking

1 Answer 35 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 13 Jan 2010, 08:47 PM
I have a question about the OnClientNodeClicking event which fires right before postback. The get_node() retrieves a reference to the clicked on node. I am wondering if there is any way that I can determine which node the user came from (i.e. not the node that there are going to, but rather the node they were on before). The get_node().get_text() tells me the text of the node that the user clicked on, but I need to get the text of the node that they were previously on.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 14 Jan 2010, 10:20 AM
Hi Dave,

One suggestion is saving the previously clicked node's text in a hiddenfield in the 'OnClientNodeClicked' event handler. Then you can access the hiddenfield to get the previously clicked node.

javascript:
 
    function OnClientNodeClicked(sender, args) { 
        var hf = document.getElementById('HiddenField1'); 
        hf.value = args.get_node().get_text(); 
    } 
    function OnClientNodeClicking(sender, args) { 
        var hf = document.getElementById('HiddenField1'); 
        var text = hf.value; 
        if (text != '') { 
            alert(text); 
        } 
        else { 
            alert("No previous node"); 
        } 
    } 

-Shinu.
Tags
TreeView
Asked by
Dave
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or