I have got a serious problem with triggersnot updating the content of UpdatePanel at appropriate time. Here's thesituation:
The master page holds three fieldset elements -each of those is dragable and resizable (YUI library). Inside each ofthose is an UpdatePanel. Each UpdatePanel holds part of the left sidemenu, so parts are separately draggable around the UI.
Next, thepage that uses this master page further has four (4) more draggablefieldsets with UpdatePanel's inside. Each of these panels holds a partof the final content - drill down. So I need to update each lowerUpdatePanel when the upper one changes. Each of the content panelsactualy holds a WebUserControl (.ascx) and those all inherit from abase control that defines and fires a common event when somethingchanges. This works. I debugged the event firing and it works justfine. The problem is that when i created Triggers and defined thecontrols that fire them and the common event nothing really happens.All those UpdatePanel's have their Mode set to Always so they did getupdated even before i added triggers with a small problem that they gotupdate after two clicks, thous showing what should have been shown oneclick back. Triggers actualy made no diference even dough I thoughtthey would.
If anybody has had the same problem and havesessed it please post your solutions. Should the UpdatePanles havetheir Mode set to Partial in order for triggers to work?
Last time I saw this "one-update-behind rendering" problem (for lack of a better term), it was a bug on my side; I was updating the data too late in the page lifecycle (so the UI had already been rendered).
A simple test to see if you have the same bug would be to take Atlas out of the equation. (Probably setting EnablePartialRendering="false" on your atlas:ScriptManager should be enough.) If the problem is still there when using normal postbacks, then you know that Atlas isn't the problem. On the other hand, if it starts working just like you'd expect (but full page refreshes, of course), then you know it's somehow related to Atlas.
As always, the best way to get help would be to create a really minimal Atlas app that demonstrates the problem and post the full code. That way other people can read through it and even try it on their own.
Hi Steve,
I tested Atlas behavior with creating a test project with one page (no master page). Then i created 2 web user controls (.ascx), added 2 UpdatePanels to the page and within each one I placed one of those user controls. Each user control contains a button which increments its number of clicks and the oposite control displays that number.
This composition works well if i set the UpdatePanels mode to Always - the user controls displays the correct number. If I set the mode to Conditional, the control - as expected - gets updated only when one of its contained controls has coused postback.
Next i tested adding Triggers to each of the UpdatePanels and link the controlId to oposite user control button and event name to click event. And afcourse setting the mode to Conditional. This also works very well.
Then I added events to controls themselfs. When the button within the control is clicked that event gets fired from the button click handler. And the user control event is then used as the target event in the UpdatePanel Trigger. Here is the problem. I am probably doing something wrong with page / user control as you suggested. Funny thing is this is a very simple page (no added code behind) and two very simple user controls. Each of user controls contains a method InnitializeControls() which sets the .Text property of the label. This method is called from Page_Load.
Is there some special way controls have to be written in order for Triggers and the Conditional Mode to work correctly? I would expect that trigger would update the panel after its target has finished initialization or after all other event handlers have finished. At what point are the triggers called? Should this involve any event bubbling?
Anyways, I need UpdatePanels to update based on user control event - the control is contained in another UpdatePanel. The problem can be fixed by explicitly setting the event handler to the publicly defined method in the control that needs to get updated when the event emiter changes. and setting the Mode to Always.
I hope there is a better way because this approach has a lot of overhead. I just don't get it why it works with buttons but not with user control events. Has this anything to do with client side clicks?
Thanks for any suggestions.
No comments:
Post a Comment