Question

please tell me how to maintain state of placeholder. i have a placeholder in which i add many image controls dynamically but when my page get refresh all controls from placeholder gets removed from it. the enableViewstate of placeholder is set to true.. please tell me how to maintain its state..

Was it helpful?

Solution

ViewState registration happens just after the Init events in the Page lifecycle.

If you are adding your dynamic images after Init, then they are not registered as part of ViewState. Your issue will be solved if you add them to your Placeholder control during Page_Init.

OTHER TIPS

I think you need to add the controls in the Page_PreInt() event

You must add dynamic controls on every page load. Controls are not stored in ViewState, only control STATES and data for controls which do not post their data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top