ViewState and Ajax UpdatePanel together, in some cases, seemingly will cause a full page back, people feel that UpdatePanel failure.
This is found when solving another problem.
The problem is this:
Added a Onpre event to a panel on the page that was placed in the UpdatePanel. Perhaps also related to Tabcontainer, in fact, is this: UpdatePanel put Tabcontainer,tabcontainer in every tab in the Panel.
Only when using ViewState to determine whether to let this panel display (with panel.visible) is normal, each operation will trigger the Onpre event. In other ways, this event is triggered only when the page is loaded for the first time, or when the whole page is postback.
In fact, I noticed that when using ViewState, any action would cause an entire page postback, which is not what we expected. We've added UpdatePanel. Fortunately, although this problem arises, the Onpre event is normal.
However, when not viewstate, UpdatePanel is normal, not full page postback, but Onpre event is not normal.
Focus: why.
The answer is: because in UpdatePanel, if you want to make a control visible false (using the Onpre event), it will never appear again.
The first time the control's visible is false, it will no longer appear (no more onpre will be triggered unless the entire page is sent back). If the visible of this control is true for the first time, the onpre is triggered normally, but if the next time visible is set to false, it will no longer be displayed and its Onpre event will not be triggered.
One way to solve this problem is to:
Avoid using visible for controls located in UpdatePanel and use "display:none;" instead.
Like this:
PANEL.ATTRIBES.ADD ("Style", "display:none;");
If you want to show it, that's it:
Panel.Attribes.Remove ("Style");