문제

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..

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top