Does PopulateOnDemand=True treenode really not require postback?

Last post 09-10-2006 8:04 AM by iamsuperman. 2 replies.

Sort Posts:

  • Does PopulateOnDemand=True treenode really not require postback?

    09-08-2006, 7:17 AM
    • Member
      150 point Member
    • iamsuperman
    • Member since 02-21-2006, 9:37 PM
    • Posts 30

    Hi all,

    I read some articles on the web and realized that if the treeview is set to PopulateNodesFromClient=True and its treenodes set to PopulateOnDemand=True, it requires no postback when populating these treenodes. So I placed a PopulateNodesFromClient=True treeview containing some PopulateOnDemand=True treenodes on an ASP.NET empty web page, then I wrote some codes to properly handle the OnTreeNodePopulate event of the treeview. Finally I placed a statement Debug.WriteLine("IsPostBack? " & Me.IsPostBack()) inside the function that handles the Page_Load event of this ASP.NET web page.

    The first time I entered this web page, the debug output window of VS.NET showed that "IsPostBack? True".

    When I clicked to expand (populate) a treenode, I had expected that it would show "IsPostBack? False" since people say this does not require a postback.

    However, it showed "IsPostBack? True".

    This means that it still actually require a postback, am I right?

    Why must it require a postback?

    What do you think?  Big Smile  Thanks.

  • Re: Does PopulateOnDemand=True treenode really not require postback?

    09-09-2006, 10:03 AM
    Answer
    • Contributor
      3,634 point Contributor
    • akjoshi
    • Member since 05-06-2006, 1:23 PM
    • INDIA
    • Posts 614

    Hi,

    Thats true that even with PopulateOnDemand=True forms Page_Load event will be called,

    because typically it is the implementation of AJAX ;

    and the main advantage of this is that whole page is not refreshed or loaded again.

    Only childs of the clicked node will be sent to client side and not whole tree which will reduce server load and download time of page.

    So if you are using some code to load first level of tree write in if(!IsPostback), so that whole tree is not loaded again.

    Hope thats helpful.

    When you ask a question, remember to click "mark as answered" when you get a reply which answers your question; this ensures the right forum member gets credit for being helpful (and makes search more relevant too).
  • Re: Does PopulateOnDemand=True treenode really not require postback?

    09-10-2006, 8:04 AM
    • Member
      150 point Member
    • iamsuperman
    • Member since 02-21-2006, 9:37 PM
    • Posts 30
    Thank you very much for your explanation. That's very helpful. Thanks a lot. Wink
Page 1 of 1 (3 items)