What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

Rate It (2)

Last post 04-18-2007 12:51 PM by raja.krish. 46 replies.

Sort Posts:

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    10-31-2006, 5:29 PM
    • Loading...
    • IDisposable
    • Joined on 04-13-2006, 5:50 PM
    • St. Louis, MO, USA, NA, Earth, Sol, Milky Way
    • Posts 37
    Excellent summary!  I also suggest reading this message for information about being agile in the presence/absence of the AJAX being installed. http://forums.asp.net/thread/1445844.aspx
    http://musingmarc.blogspot.com
  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-01-2006, 1:49 AM
    • Loading...
    • RajivR
    • Joined on 11-01-2006, 6:42 AM
    • Posts 1
    I have a web application which is close to release. In one of the pages I use a treeview control (System.Web.UI.WebControls.TreeView) inside an update panel and after upgrading to Beta 1 nothing works!!! It just throws Javascript errors. My code just adds some nodes through a button inside the update panel. Please tell me what to do  as my deadline is coming and my application no longer works.
  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-01-2006, 10:45 AM
    • Loading...
    • mc24
    • Joined on 09-21-2006, 6:34 AM
    • Posts 8

    Hi Eilon !

    We have an Atlas-site thats just ready for deployment - but we wanted to upgrade to the Beta before releasing it !

    Unfourtunatly we make heavy use of treeviews i updatepanel - and its been working execellent. But now they still work if they are populated in the first pageload, but if we repopulate them - they start acting very strange when selecting a node (but only then !). It colapses the selected bransch and expands annother an so forth.

    Is there anyway for us fix this glitch (registrering the scripts or something ) or is it just to wait like you mentioned ?

    A lot of work waisted - it feels like !

    Help

     

     

     

     

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-01-2006, 10:57 AM
    • Loading...
    • aspBOD
    • Joined on 01-21-2005, 11:11 AM
    • Posts 113

    I have buit a fix for the asp:menu control - this should be similar to your problem.

     

    Register the following script with the script manager using the follow c#:


    Microsoft.Web.UI.ScriptManager.RegisterClientScriptInclude(Page, GetType(), GetType().ToString(), Page.ResolveUrl(filePath));
       

    The javascript:

    function __doPostBack(eventTarget, eventArgument) {

    //This is a temporary hack until Microsoft update the Menu control  
    var form = this._form;
    form.__EVENTTARGET.value = eventTarget;
    form.__EVENTARGUMENT.value = eventArgument;
    this._postBackSettings.async=true;
    this._onFormSubmit();
     
    }

     Works for me

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-02-2006, 3:32 AM
    • Loading...
    • mc24
    • Joined on 09-21-2006, 6:34 AM
    • Posts 8

    Hi aspBOD !

    Do you think your hack would make any difference for a treeview in an updatepanel ?

    and in that case where does the c# code go - in Page_PreRender ? Do you a little more specific example ?

    Does __doPostBack function override the existing ?

    Want it to work for me too

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-02-2006, 9:53 AM
    • Loading...
    • Codematic
    • Joined on 11-02-2006, 2:46 PM
    • Posts 42

    Hi,

    i have the same problem with the menu-control inside an updatepanel, but this workaround does not work for me.

    aspBOD:

    I have buit a fix for the asp:menu control - this should be similar to your problem.

    Register the following script with the script manager using the follow c#:

    Microsoft.Web.UI.ScriptManager.RegisterClientScriptInclude(Page, GetType(), GetType().ToString(), Page.ResolveUrl(filePath));
       
    The javascript:
    function __doPostBack(eventTarget, eventArgument) {
    //This is a temporary hack until Microsoft update the Menu control  
    var form = this._form;
    form.__EVENTTARGET.value = eventTarget;
    form.__EVENTARGUMENT.value = eventArgument;
    this._postBackSettings.async=true;
    this._onFormSubmit();

    }

     Works for me

    When can we expect a new release with a working menu-control inside an updatepanel?

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-02-2006, 12:18 PM
    • Loading...
    • Eilon
    • Joined on 06-26-2002, 6:14 PM
    • Redmond, WA
    • Posts 716
    • AspNetTeam

    Hi everyone, here are some responses to the recent posts:

    1. Customizing how UpdatePanel is rendered (EssaiMeilleur):

    You can derive from UpdatePanel to control at least part of how it is rendered. In fact, if you completely overrode its Render method you could probably get it to render out something other than a <div> or a <span>. We limited it to those two tags since we felt that they by far covered most scenarios (I think this is the first time I've heard a real concern about it).

    2. Toolkit problems (flaxon):

    I'd suggest that you keep asking on the Toolkit forums. My understanding is that they have this fixed for the upcoming Beta 2 release, so you should be up and running pretty soon.

    3. Menu and TreeView compatibility (aspBOD, Codematic, mc24, RajivR):

    We felt that Menu and TreeView are not as important inside UpdatePanels for a couple of reasons. First, most Menus remain fairly static (just most, not all), so there's no need to update. Second, TreeView already has built-in AJAX functionality to populate its nodes dynamically, so it's also not as important inside an UpdatePanel. Either way, in Orcas (the next version of ASP.NET) we plan to have all the ASP.NET controls that we ship be compatible inside UpdatePanels. There will also be plenty of 3rd party controls that are compatible with UpdatePanel (see ComponentArt, for example).

    Thanks,

    Eilon

    Blog: http://weblogs.asp.net/LeftSlipper/
  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-02-2006, 3:03 PM
    • Loading...
    • uri
    • Joined on 05-15-2006, 7:23 PM
    • Posts 13

    Hi Eilon,

    Maybe my problem is specific to my implementation, but I am having trouble to manipulate controls that are created dynamically inside the UpdatePanel.

    My page creates a table on the fly with Checkboxes... based on some database rows.

    I cannot iterate the table and find all the checked items (this is after posting back a Delete_Click), but for other controls (like labels or textboxes) no issue to change properties.

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-07-2006, 12:06 AM
    • Loading...
    • EssaiMeilleur
    • Joined on 09-25-2006, 9:18 PM
    • Tampa Bay, FL
    • Posts 60
    Eilon:

    1. Customizing how UpdatePanel is rendered (EssaiMeilleur):

    You can derive from UpdatePanel to control at least part of how it is rendered. In fact, if you completely overrode its Render method you could probably get it to render out something other than a <div> or a <span>. We limited it to those two tags since we felt that they by far covered most scenarios (I think this is the first time I've heard a real concern about it).

    That's exactly what I did and it works great, but like I said, it would be nice if the UpdatePanel came with that ability out of the box. With Microsoft seemingly moving towards supporting more standard HTML/CSS designs, it would only make sense for the UpdatePanel's rendering to be fairly flexible. When I design a web page, I do so with the intentions of writing the leanest amount of markup possible (as well as semantic), and then I'll build my server-side functionality around that. I've already had numerous situations where I wanted pieces of content updated via Atlas, but my design didn't accommodate a div or a span element, and I wasn't about the have one thrown in there by the UpdatePanel. I think people abuse the div and span elements enough as it is, constraining the UpdatePanel to them will only perpetuate that trend. If developers were able to dynamically update a paragraph, blockquote, or definition list (for instance) via Atlas, they would likely embrace it, and be more inclined to give more thought to their HTML.

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-07-2006, 3:35 AM
    • Loading...
    • Codematic
    • Joined on 11-02-2006, 2:46 PM
    • Posts 42
    Eilon:

    3. Menu and TreeView compatibility (aspBOD, Codematic, mc24, RajivR):

    We felt that Menu and TreeView are not as important inside UpdatePanels for a couple of reasons. First, most Menus remain fairly static (just most, not all), so there's no need to update. Second, TreeView already has built-in AJAX functionality to populate its nodes dynamically, so it's also not as important inside an UpdatePanel. Either way, in Orcas (the next version of ASP.NET) we plan to have all the ASP.NET controls that we ship be compatible inside UpdatePanels. There will also be plenty of 3rd party controls that are compatible with UpdatePanel (see ComponentArt, for example).

    This one is not fixed in beta2. Our application is near to go live. When can we expect a new beta release whis a fixed menu-control inside updatepanel. Will it be in December?

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-07-2006, 6:03 AM
    • Loading...
    • leodippolito
    • Joined on 08-30-2006, 8:36 AM
    • London UK
    • Posts 120

    In my scenario the TreeView inside UpdatePanel is necessary.

    The user should be able to add and remove nodes of the TreeView. If I let the page with full postback, the performance gets really bad.

    If I could have the TreeView inside UpdatePanel, that would be a great solution.

     

     

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-09-2006, 2:51 AM
    • Loading...
    • mc24
    • Joined on 09-21-2006, 6:34 AM
    • Posts 8

    Hi

    I have same situation as leodippolito.

    It's seems to bad that I can't register the TreeViews scripts in order to get to work in an updatepanel - especially when it's so close to working.

    Doesn't anyone have workaround or a clue how to approach this problem ? Dynamic treeviews (which they become with updatepanel) are very handy to solve certain problems.

     

     

     

     

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-09-2006, 3:26 AM
    • Loading...
    • usego
    • Joined on 11-08-2006, 5:09 PM
    • Posts 9
    Eilon:

    3. Menu and TreeView compatibility (aspBOD, Codematic, mc24, RajivR):

    Second, TreeView already has built-in AJAX functionality to populate its nodes dynamically, so it's also not as important inside an UpdatePanel. .

    Not only populating tree nodes need async postback, selecting nodes is also very important. In my web application user goes through organization hierarchy in tree, selects department treenode it becomes bold and right panel is updated with corresponding information.

     Also there is another issue with big trees, check http://forums.asp.net/thread/1457500.aspx ... I know it's my bad design, I have to rewrite tree logic to make tree more light, but in any case recursive _destroyTree method could be a big issue.

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-13-2006, 8:42 PM
    • Loading...
    • ChronicleJ
    • Joined on 07-25-2006, 2:20 AM
    • Posts 2

    Eilon:

    We felt that it was far less common to have these controls inside UpdatePanels compared to the validators. The TreeView control has built-in AJAX functionality anyway.

    Eilon

    The TreeView control's built-in AJAX functionality definately makes its use with an UpdatePanel less common, if not completely redundant.   However, this same functionality makes the TreeView an invaluable tool for loading small portions of a large DataSet with the TreeNodePopulate Event.  While the TreeView does not need to be in an UpdatePanel, it does on the other hand need to be a part of an asynchronous Trigger.

    The PopulateOnDemand functionality is completely seemless and equally easy to implement, but posting back each time you select a node is that much more ungainly as a part of an otherwise responsive AJAX website.  I don't care about putting the TreeView inside the UpdatePanel, but forcing a postback each time I select a Node defeats the purpose of the control.

    I have looked at the Forums for a way to get around this, but everything is very hacky, and presenting it to my boss seems like a terribly stupid move....For what its worth, I love this project despite the changes and eagerly await the next release.

  • Re: What's up with UpdatePanels and how come nothing works? Or: A brief explanation of how UpdatePanel works by the guy who wrote the feature. (Long!)

    11-13-2006, 8:59 PM
    • Loading...
    • jodywbcb
    • Joined on 03-12-2003, 11:52 AM
    • West Seattle,WA
    • Posts 985

    Is possible you can use IFRAME for this?  This is how I worked around dealing with having menus and not wanting to disrupt the overall page...This way I could keep the "main screen" fixed - and still have the flexibility of loading update panels etc...

     

    IFRAME does work in a Ajax enviroment...and when you think about it the iframe is the first ever ajax feature introduced to the browser world...

     

     

    -- jody
    My Blogs on .Net 2.0 and Ajax
    http://csk.wbcb.com
    http://ArtbyJody.com