Wednesday, March 28, 2012

Multiple UpdatePanels require their controls to enable ViewState?

I've got 2 update panels on the same page. up1 contains a link button and up2 contains a repeater. I don't need or want the repeater in up2 to be added to Viewstate. However, when up1's link button is clicked, the async call works fine but on return it clears out up2's content. If I set the repeater in up2 to enable viewstate, it then works. If upatepanels are supposed to implement partial page updates, why does up1 wipe out up2's content if up2's content is not in viewstate?

A wild stab in the dark : Is up2.UpdateMode set to "Condtional" ?? if not, then it has a default mode "Always", and gets refreshed on each async postback. If you do not redraw the repeater at that time, or get it from viewstate, then well - you get zilch :)


Ah, yes, that's it. I would have thought the default updatemode would be "Conditional" rather than "Always". Having all the updatepanels update seems counterintuitive to the idea of a partial page update. Anyway, thanks.

No comments:

Post a Comment