TreeView - want node selection WITHOUT POSTBACK

Discussion in 'ASP .Net' started by Martin Randall, Apr 11, 2006.

  1. Can anyone tell me if it is possible to get the TreeView control in ASP.Net
    2.0 to allow node selection without triggering a postback?

    Thanks!

    Martin Randall
     
    Martin Randall, Apr 11, 2006
    #1
    1. Advertising

  2. You could consider using AJAX (or ATLAS in MS-speak) http://atlas.asp.net

    "Martin Randall" wrote:

    > Can anyone tell me if it is possible to get the TreeView control in ASP.Net
    > 2.0 to allow node selection without triggering a postback?
    >
    > Thanks!
    >
    > Martin Randall
    >
    >
    >
     
    =?Utf-8?B?REhMZW5ub24=?=, Apr 12, 2006
    #2
    1. Advertising

  3. I'm pretty sure that's what they use on this forum!

    "DHLennon" wrote:

    > You could consider using AJAX (or ATLAS in MS-speak) http://atlas.asp.net
    >
    > "Martin Randall" wrote:
    >
    > > Can anyone tell me if it is possible to get the TreeView control in ASP.Net
    > > 2.0 to allow node selection without triggering a postback?
    > >
    > > Thanks!
    > >
    > > Martin Randall
    > >
    > >
    > >
     
    =?Utf-8?B?REhMZW5ub24=?=, Apr 12, 2006
    #3
  4. On the treeview:
    PopulateNodesFromClient = true
    EnableClientScript = true

    On each node you add to the treeview:
    PopulateOnDemand = true

    Make sure to only do this on nodes that have children (save your bandwidth).
    The only other thing you have to do is add an event handler to the
    TreeView's TreeNodePopulate event. The event args include the node that
    needs its children populated. Just stick new child nodes in it and that's
    that! Its nice, but there are some bugs that need to get worked out of it...

    "Martin Randall" wrote:

    > Can anyone tell me if it is possible to get the TreeView control in ASP.Net
    > 2.0 to allow node selection without triggering a postback?
    >
    > Thanks!
    >
    > Martin Randall
    >
    >
    >
     
    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=, Apr 12, 2006
    #4
  5. Okay... nice answer, but not to the question I asked, but nice answer
    anyway...


    "William Sullivan" <> wrote in
    message news:...
    > On the treeview:
    > PopulateNodesFromClient = true
    > EnableClientScript = true
    >
    > On each node you add to the treeview:
    > PopulateOnDemand = true
    >
    > Make sure to only do this on nodes that have children (save your
    > bandwidth).
    > The only other thing you have to do is add an event handler to the
    > TreeView's TreeNodePopulate event. The event args include the node that
    > needs its children populated. Just stick new child nodes in it and that's
    > that! Its nice, but there are some bugs that need to get worked out of
    > it...
    >
    > "Martin Randall" wrote:
    >
    >> Can anyone tell me if it is possible to get the TreeView control in
    >> ASP.Net
    >> 2.0 to allow node selection without triggering a postback?
    >>
    >> Thanks!
    >>
    >> Martin Randall
    >>
    >>
    >>
     
    Martin Randall, Apr 13, 2006
    #5
  6. Tsk... anyway of doing it *without* using AJAX? And if I did use AJAX, I
    would still need to trap the clientside event without causing a postback
    which is the whole point of this post in the first place.

    "DHLennon" <> wrote in message
    news:...
    > You could consider using AJAX (or ATLAS in MS-speak) http://atlas.asp.net
    >
    > "Martin Randall" wrote:
    >
    >> Can anyone tell me if it is possible to get the TreeView control in
    >> ASP.Net
    >> 2.0 to allow node selection without triggering a postback?
    >>
    >> Thanks!
    >>
    >> Martin Randall
    >>
    >>
    >>
     
    Martin Randall, Apr 13, 2006
    #6
  7. Martin Randall

    Guest

    You may want to look at the treeviews from obout.com (free) or
    componentart. One nice thing with each of these is that they
    dynamically fill branches without either a visible postback or ajax, by
    calling a separate aspx page to fill the branch. Very intriguing when
    you see it.

    On the other hand, these treeviews have their own idosyncrasies, and
    you may end up using one for a while and then finding a limitation
    that's a show stopper.
     
    , Apr 13, 2006
    #7
  8. Martin Randall

    Guest

    I think what he's asking is how to remove the call to:

    javascript:__doPostBack

    from the TreeView node expand or collapse image.

    I'm having the same problem. Is there any way to get rid of that
    javascript function call?

    Here's an example of what is added when I view the source:
    <a
    href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$tvNavigate','tFY2008')"><img
    src="/FMFIMET/WebResource.axd?d=T97pv8xbNNluDolWp8ffnd8xHGrs20GjDDdugfkoz5QUFUuDBCccU4RYFtFa3B9p0&amp;t=632744904971536555"
    alt="Collapse FY2008" style="border-width:0;" /></a>
     
    , Apr 24, 2006
    #8
  9. Well, I have the same question. I use the TreeView for a handy container for
    related information. I just want it to expand/contract clientside. But I DO
    NOT want it to "javascript:__doPostBack" on node select. There's no
    AutoPostBack = false as far as I can see or way to override this click event.

    So, how iz it done?


    "" wrote:

    > I think what he's asking is how to remove the call to:
    >
    > javascript:__doPostBack
    >
    > from the TreeView node expand or collapse image.
    >
    > I'm having the same problem. Is there any way to get rid of that
    > javascript function call?
    >
    > Here's an example of what is added when I view the source:
    > <a
    > href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$tvNavigate','tFY2008')"><img
    > src="/FMFIMET/WebResource.axd?d=T97pv8xbNNluDolWp8ffnd8xHGrs20GjDDdugfkoz5QUFUuDBCccU4RYFtFa3B9p0&t=632744904971536555"
    > alt="Collapse FY2008" style="border-width:0;" /></a>
    >
    >
     
    =?Utf-8?B?QWFyb24gWmFsZXdza2k=?=, May 1, 2006
    #9
  10. Nevermind, I figured it out. When you assign the Text of the node, just wrap
    the text in a <span> and intercept the click so it doesn't bubble to the <A>
    which is where the postback is picked up.

    Ex:
    node.Text = "<span onclick='return false;'>"+NodeLabel+"</span>";

    "Aaron Zalewski" wrote:

    > Well, I have the same question. I use the TreeView for a handy container for
    > related information. I just want it to expand/contract clientside. But I DO
    > NOT want it to "javascript:__doPostBack" on node select. There's no
    > AutoPostBack = false as far as I can see or way to override this click event.
    >
    > So, how iz it done?
    >
    >
    > "" wrote:
    >
    > > I think what he's asking is how to remove the call to:
    > >
    > > javascript:__doPostBack
    > >
    > > from the TreeView node expand or collapse image.
    > >
    > > I'm having the same problem. Is there any way to get rid of that
    > > javascript function call?
    > >
    > > Here's an example of what is added when I view the source:
    > > <a
    > > href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$tvNavigate','tFY2008')"><img
    > > src="/FMFIMET/WebResource.axd?d=T97pv8xbNNluDolWp8ffnd8xHGrs20GjDDdugfkoz5QUFUuDBCccU4RYFtFa3B9p0&t=632744904971536555"
    > > alt="Collapse FY2008" style="border-width:0;" /></a>
    > >
    > >
     
    =?Utf-8?B?QWFyb24gWmFsZXdza2k=?=, May 1, 2006
    #10
  11. Martin Randall

    dradcliffe

    Joined:
    Oct 19, 2010
    Messages:
    1
    I know this is an old thread... but i had same issue and while searching I end up to this thread. So now that I have found the solution, I thought its better to share it so someone who needs it in future can get it.

    Solution is "SelectAction" property of TreeNode. Just set it to None and that label will not be clickable. If you set it to Expand, that node will expand to show its children.
     
    dradcliffe, Oct 19, 2010
    #11
    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:
    0
    Views:
    1,670
  2. amirmi
    Replies:
    0
    Views:
    838
    amirmi
    Aug 1, 2006
  3. amirmi
    Replies:
    1
    Views:
    680
    nataliepea
    Sep 8, 2006
  4. amirmi
    Replies:
    0
    Views:
    633
    amirmi
    Aug 1, 2006
  5. Tjerk Wolterink
    Replies:
    2
    Views:
    1,521
    Dimitre Novatchev
    Aug 24, 2006
Loading...

Share This Page