We have a web app(-ish) webform, and we use many custom UserControl
s. We load a bunch of them in each view, but we don't want them to render, or even pre-render, until we don't have to use them. Then we set Visible = False
in each control and then we use Update Panel
s to set it to True
whenever the control is needed. The control then shows up correctly.
But in the next postback we have a very nasty MAC validation error, and we think it is related to the ASP not updating the viewstate (but I don't know if that's entirely true yet).
The question: Is it possible to know in exactly wich argument the MAC validation is throwing an error? If we're right, and the ViewState
for the user controls is not being updated in the already sent page, what would be the correct way to do it / workaround for it?
Many thanks
I've since learnt a lot of ASP, so I will clarify my failure points:
Of course, it's absolutelly
false
. ASP updates the entireViewState
on every post back, so there's no way to not update it.The MAC validation issue occured when we turned on the UserControl (
Visible=true
) because we didn't specify the validation of the events that control performed (performing custom__doPostBack()
s)So, the assumption is entirelly incorrect, and the error goes away by simply registering with
RegisterForEventValidation()
(see here)