|
| Modal control completely broken on pages that do postback |
 |
Mon, 2 Oct 2006 02:07:37 +0000 |
I'm developing a new set of pages for the Wiki functionality, and I wanted to
use the Modal popup to enable file upload. THe file upload bit works GREAT
except that after any "real" postback, the values of the ModalLink or
ModalButton are not refreshed properly.
The reasons are very simple. All of the properties of the ModalLink and
ModalButton controls are in private member fields. So after a postback, the
control is in the control collection heirachy, but the values of the control's
properties were never saved to ViewState.
Microsoft provides 2 solutions for dealing with postback:
a) the pattern used more commonly throughout the ASP.NET framework: Instead of
private member variables, use property accessors that get and set values
directly from the control's ViewState bag.
b) override the LoadViewState member to restore member variables from the state
bag, and persist the member variables in (commonly) either the OnPreRender or
Render methods.
I'm trying to find a CommunityServer page that does a real postback, but I can't
seem to find very many. I imagine that I'm going to have this problem with MANY
CS stock controls.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|