开发者

Adding control to a panel at runtime

I'd like to add a control A (that exists on a page) to a Footer user control's panel. If I create the control A dynamically and add it, I don't have issues. But I would like to avoid adding this dynamically.

So, I defined control A in the aspx page and in the code behind, I got reference to the footer's panel and did a Controls.Add() It works fine, but postb开发者_运维百科acks from this control has strange behavior (could be due to viewstate?) as it doesn't execute some code that is on the page with a !IsPostback condition

Has anyone got something like this working?


I think you might have some inherit issues with doing this, as the same control existing twice could be a problem. However, if you are "moving things around", you want to be sure that the control is in the same place on Page_Init() rather than load.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜