开发者

How To maintain ViewState of PlaceHolder in asp.net

please tell me how to maintain state of placeholder. i have a placeholder in which i add many image controls dynamically bu开发者_高级运维t 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜