treeview:how to get the selected node on javascript click event

Discussion in 'ASP .Net Web Controls' started by Naim Rizk, Sep 20, 2003.

  1. Naim Rizk

    Naim Rizk Guest

    hi,
    I have a treeview with nodes that contain images of a checkbox. it can
    be an image of a checked or unchecked checkbox. When a user click on a
    node the image of the checkbox will change from checked to unchecked and
    vice versa. And of course that will be done on the client side.

    i added this javasript function.

    function myfunction(){
    SelectedNode =
    event.srcElement.getTreeNode(event.treeNodeIndex);
    if (SelectedNode.ImageUrl == "image1") {
    SelectedNode.ImageUrl= "image2";
    else
    SelectedNode.ImageUrl= "image1";
    }

    anyway event.srcElement.getTreeNode(event.treeNodeIndex) is returning
    null.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Naim Rizk, Sep 20, 2003
    #1
    1. Advertising

  2. Naim Rizk

    Naim Rizk Guest

    i just found that I can display a checkbox treeview by setting the
    checkbox propety of the node to true. so my problem is solved. but
    anyway if someone can tell we how we can get the selected node in
    javascript and change the image,the text... i'll appreciate it

    Naim

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Naim Rizk, Sep 21, 2003
    #2
    1. Advertising

  3. Naim Rizk

    rune solheim Guest

    Hi,

    try to use:
    SelectedNode =
    event.srcElement.getTreeNode(event.srcElement.clickedNodeIndex);

    instead of:
    SelectedNode = event.srcElement.getTreeNode(event.treeNodeIndex);

    /Rune


    "Naim Rizk" <> wrote in message
    news:Of%...
    >
    >
    > i just found that I can display a checkbox treeview by setting the
    > checkbox propety of the node to true. so my problem is solved. but
    > anyway if someone can tell we how we can get the selected node in
    > javascript and change the image,the text... i'll appreciate it
    >
    > Naim
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    rune solheim, Sep 23, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    9,030
    Daniel TIZON
    Dec 17, 2005
  2. Alan Silver
    Replies:
    0
    Views:
    514
    Alan Silver
    Dec 21, 2005
  3. =?Utf-8?B?V2Vz?=
    Replies:
    2
    Views:
    18,795
    sankar
    Jul 3, 2006
  4. K B
    Replies:
    0
    Views:
    3,110
  5. chandrajit_in
    Replies:
    0
    Views:
    1,664
    chandrajit_in
    Jan 3, 2008
Loading...

Share This Page