开发者

Paging dynamic controls

I need add pa开发者_C百科ging to panel, which populated with dynamically-created controls. I want implement paging as several LinkButtons. Populating panel(re/create controls) is executed at Page_Load.

Click on LinkButton and save currentpage is executed after page_Load, so I don't know what I should show(what current page) at Page_Load when build panel with controls.

What should I do for implement this scenario?

Thanks, Andrew


Re/create controls at page_Load is to late. Create the controls at page_Init, otherwise ViewState will not work. Just the Data binding portion of your code belongs to page_Load.

You are right that you shouldn't change the control structure in the LinkButtons event handler. Persist the page state (probably in SessionState) and redirect the page to itself. The next page life cycle, initiated by the redirect, will do the recreation.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜