"AJAX" techniques for the ASPNET 2.0 TreeView control?

Discussion in 'ASP .Net Web Controls' started by KJ, Jun 20, 2006.

  1. KJ

    KJ Guest

    Hello All,

    Just wondering is it possible to add/edit/remove nodes from a TreeView
    via AJAX techniques. I currently have an ASPNET 1.1 app that heavily
    uses the IE WebControl TreeView, and I am having to repaint the entire
    page as the user is changing the node content. I'd like to avoid this
    and am hoping this is possible. In your replies, could you also point
    me to some example code for accomplishing this?

    Thanks in advance,
    -KJ
    KJ, Jun 20, 2006
    #1
    1. Advertising

  2. Yes, you can modify the nodes dynamically through code if you wish.
    When you configure the Treeview to use callbacks, you must put code in the
    TreeNodePopulate event. This is the event where you put your logic to
    return only the nodes you desire.

    Here's more info and an example, as you requested:
    http://SteveOrr.net/articles/Ajax.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "KJ" <> wrote in message
    news:...
    > Hello All,
    >
    > Just wondering is it possible to add/edit/remove nodes from a TreeView
    > via AJAX techniques. I currently have an ASPNET 1.1 app that heavily
    > uses the IE WebControl TreeView, and I am having to repaint the entire
    > page as the user is changing the node content. I'd like to avoid this
    > and am hoping this is possible. In your replies, could you also point
    > me to some example code for accomplishing this?
    >
    > Thanks in advance,
    > -KJ
    >
    Steve C. Orr [MVP, MCSD], Jun 21, 2006
    #2
    1. Advertising

  3. KJ

    KJ Guest

    Hi Steve,

    I checked out your article and have begun to try out the techniques. I
    have a couple of questions.

    Let's say I do need to update some other control's UI based on a click
    that does performs an async callback. I can see that this is not
    possible, because, as you state, the visual aspect of other controls
    cannot be changed because the HTML is not re-rendered.

    But is there any other way to accomplish this. I have, for example, a
    page that has many controls whose visibility is not simply turned on
    and off (which could easily be done client-side), but rather, the
    visibility is dependent on the return values from database calls (i.e.,
    the query determines the UI). Any ideas on getting around this one
    without reposting the whole page?


    Steve C. Orr [MVP, MCSD] wrote:
    > Yes, you can modify the nodes dynamically through code if you wish.
    > When you configure the Treeview to use callbacks, you must put code in the
    > TreeNodePopulate event. This is the event where you put your logic to
    > return only the nodes you desire.
    >
    > Here's more info and an example, as you requested:
    > http://SteveOrr.net/articles/Ajax.aspx
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    > "KJ" <> wrote in message
    > news:...
    > > Hello All,
    > >
    > > Just wondering is it possible to add/edit/remove nodes from a TreeView
    > > via AJAX techniques. I currently have an ASPNET 1.1 app that heavily
    > > uses the IE WebControl TreeView, and I am having to repaint the entire
    > > page as the user is changing the node content. I'd like to avoid this
    > > and am hoping this is possible. In your replies, could you also point
    > > me to some example code for accomplishing this?
    > >
    > > Thanks in advance,
    > > -KJ
    > >
    KJ, Jun 21, 2006
    #3
  4. Sure, you can use JavaScript to update page elements via client side script
    depending on the return values you got from your AJAX call.
    Here's a more complex AJAX example where I demonstrate such things:
    http://SteveOrr.net/articles/WebChat.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net




    "KJ" <> wrote in message
    news:...
    > Hi Steve,
    >
    > I checked out your article and have begun to try out the techniques. I
    > have a couple of questions.
    >
    > Let's say I do need to update some other control's UI based on a click
    > that does performs an async callback. I can see that this is not
    > possible, because, as you state, the visual aspect of other controls
    > cannot be changed because the HTML is not re-rendered.
    >
    > But is there any other way to accomplish this. I have, for example, a
    > page that has many controls whose visibility is not simply turned on
    > and off (which could easily be done client-side), but rather, the
    > visibility is dependent on the return values from database calls (i.e.,
    > the query determines the UI). Any ideas on getting around this one
    > without reposting the whole page?
    >
    >
    > Steve C. Orr [MVP, MCSD] wrote:
    >> Yes, you can modify the nodes dynamically through code if you wish.
    >> When you configure the Treeview to use callbacks, you must put code in
    >> the
    >> TreeNodePopulate event. This is the event where you put your logic to
    >> return only the nodes you desire.
    >>
    >> Here's more info and an example, as you requested:
    >> http://SteveOrr.net/articles/Ajax.aspx
    >>
    >> --
    >> I hope this helps,
    >> Steve C. Orr, MCSD, MVP
    >> http://SteveOrr.net
    >>
    >>
    >> "KJ" <> wrote in message
    >> news:...
    >> > Hello All,
    >> >
    >> > Just wondering is it possible to add/edit/remove nodes from a TreeView
    >> > via AJAX techniques. I currently have an ASPNET 1.1 app that heavily
    >> > uses the IE WebControl TreeView, and I am having to repaint the entire
    >> > page as the user is changing the node content. I'd like to avoid this
    >> > and am hoping this is possible. In your replies, could you also point
    >> > me to some example code for accomplishing this?
    >> >
    >> > Thanks in advance,
    >> > -KJ
    >> >

    >
    Steve C. Orr [MVP, MCSD], Jun 21, 2006
    #4
  5. KJ

    Guest

    KJ,

    Like Steve mentions in his article this could be done manually by
    registering appropriate code, implementing appropriate interfaces and
    listenting to appropriate events. I could be wrong, but, I think this
    approach may not maintain the ViewState for you. Steve, please clarify.

    So, if you want a high-level solution for this, you could go the ATLAS
    route where they provide a RefreshPanel (I believe) through which you
    can easily refresh any portion of the page. I am not sure if they
    maintain ViewState either.

    Or, you could use a 3rd party solution like our's, Essential Tools for
    ASP.Net from Syncfusion which comes with a CallbackPanel and
    CallbackMultiplexer that does the same for you with great ease. Check
    out the demos at:

    http://www2.syncfusion.com/2.0/samples.aspx

    Browse to Tools.web/CallbackControls. There are plenty of samples (with
    code) that are similar to the scenario you mention above.

    Regards,
    Praveen
    Syncfusion, Inc.
    Complete set of ASP.Net controls and components
    www.syncfusion.com/toolsweb
    , Jun 21, 2006
    #5
    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. Gary Nelson

    Upgrade from aspnet 1.1 to aspnet 2.0

    Gary Nelson, Oct 14, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    479
    Gary Nelson
    Oct 14, 2005
  2. Replies:
    0
    Views:
    478
  3. minnie
    Replies:
    1
    Views:
    684
    Andrew Thompson
    Dec 13, 2006
  4. Replies:
    7
    Views:
    642
    Juan T. Llibre
    Mar 23, 2007
  5. ton
    Replies:
    2
    Views:
    2,147
Loading...

Share This Page