Treeview control's selectednodeindex property in javascript

Last post 11-10-2008 7:39 AM by Matter. 6 replies.

Sort Posts:

  • Treeview control's selectednodeindex property in javascript

    12-02-2005, 4:10 PM
    • Member
      5 point Member
    • sphatak
    • Member since 12-02-2005, 9:02 PM
    • Posts 1

    I am trying to get the selectednodeindex property of the Microsoft Treeview webcontrol but having no luck. I am getting an error "undefined". Does that mean I cannot access this property using javascript? I want it in javascript to avoid postback. Is it possible to get the index of the node selected or the text selected in any other way on the client side?

    Here is my javascript code snippet: alert(document.all.iform.TreeViewCtrl.SelectedNodeIndex)

    Any help with me highly appreciated!

    Thanks.

     

     

     

     

  • Re: Treeview control's selectednodeindex property in javascript

    01-04-2006, 7:19 AM
    • Member
      150 point Member
    • UBGandalf
    • Member since 04-09-2004, 2:15 AM
    • Posts 38
    I'm really waiting an answer for this question too. Postback on -/+ doesn't make any sense.

    Please share if you fand a solution. Updating treeview.htc file didn't work for me and I tried to catch onexpand and oncollapse events from javascript. I did it but how can I make TreeView expand and collapse ?

    This is the whole story...

    Thanks

  • Re: Treeview control's selectednodeindex property in javascript

    01-04-2006, 11:03 PM
    • Member
      5 point Member
    • hkhawaja
    • Member since 01-05-2006, 3:08 AM
    • Posts 1

    You need to override the events and point them to JS methods.

    In the aspx page add this JS method, assuming your treeview object is called treeView.

    <script language="javascript">

    function myFunc()

    {

    }

    </script>

    function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { } function myFunc() { }

    Then in Page_Load add the following:

    treeView.Attributes.Add("onexpand","javascript:myFunc()");

    treeView.Attributes.Add("oncollapse","javascript:myFunc()");

    This should let you expand and collapse client side with no round trips.

  • Re: Treeview control's selectednodeindex property in javascript

    01-19-2006, 6:07 AM
    • Member
      5 point Member
    • Sophie
    • Member since 01-19-2006, 5:16 AM
    • Posts 1

    Hi..this is working to suppress the expand event and for avoiding postback

    But when i try to select any child node an exception is being thrown.It says

    The node at index 0.0 is not currently displayed in the tree. SelectedNodeIndex cannot be set to an undisplayed node .

    Can some one help me ???..Thanks in advance!!!

  • Re: Treeview control's selectednodeindex property in javascript

    03-25-2008, 8:05 AM
    • Member
      640 point Member
    • shaikhather
    • Member since 06-30-2003, 2:35 AM
    • Abu Dhabi, UAE
    • Posts 164

    Hi,

    It is a very late reply but still you are looking for better solution it is here.

    set the following if you are using ASP.NET 2.0

    nodeCat.SelectAction = TreeNodeSelectAction.None

    Regards,

     

    Ather Ali Shaikh
    Sr. System Analyst
    GASCO
    Abu Dhabi, UAE.
  • Re: Treeview control's selectednodeindex property in javascript

    11-10-2008, 12:52 AM
    • Member
      8 point Member
    • Matter
    • Member since 11-10-2008, 12:42 AM
    • Posts 6
    Hello All, I am using tree view control and use xmlsitemap for the datasource. I want some thing like, If user select particular parent node then other node should be collapse, using javascript. I don't want post back. Can anybody tell me on which event i have to write javascript logic. Thanks
  • Re: Treeview control's selectednodeindex property in javascript

    11-10-2008, 7:39 AM
    • Member
      8 point Member
    • Matter
    • Member since 11-10-2008, 12:42 AM
    • Posts 6

    friends, i am waiting for the reply as i stuck at this point. any Idea

Page 1 of 1 (7 items)