Question regarding OnClientNodeClicking

2 posts, 1 answers
  1. Dave Durose
    Dave Durose avatar
    44 posts
    Member since:
    Jan 2008

    Posted 13 Jan 2010 Link to this post

    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.
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Jan 2010 Link to this post

    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.
Back to Top