开发者

In reality, are server controls rarely added programmatically to aspx pages?

开发者 https://www.devze.com 2023-02-06 06:07 出处:网络
I mean, it\'s easy to add a Button programmactically to an aspx page, but a server con开发者_如何学运维trol\'s event handler probably has to be set early in the page life cycle (maybe before Control.L

I mean, it's easy to add a Button programmactically to an aspx page, but a server con开发者_如何学运维trol's event handler probably has to be set early in the page life cycle (maybe before Control.Load event). As a result in reality, are dynamic controls rarely added to apsx pages?

I wish there is a way to call postback at the server, so that a event is never too late.


If you add the controls in the PreInit or Init events, there are no problems. I dynamically add controls to my webforms pages all the time.


Best thing to do would be read Truly Understanding ViewState and Truly Understanding Dynamic Controls -- you really can't start to do anything really hinky in webforms without that knowledge.

0

精彩评论

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