开发者

Creating web controls inside a content placeholder programmatically

开发者 https://www.devze.com 2023-02-21 18:14 出处:网络
I\'ve got a master page and a content page. How can I add controls to the master page\'s content placehold开发者_JS百科ers programmatically?Try something like following:

I've got a master page and a content page. How can I add controls to the master page's content placehold开发者_JS百科ers programmatically?


Try something like following:

this.Master.Controls.FindControl("ContentPlaceHolderID").Controls.Add(yourControl);


this.Page.Master.FindControl

As said above would work fine.

Alternatively, make whatever placeholder in your master page a ContentPlaceHolder, and then your child pages can put stuff there directly without having to go up through the Master page.

0

精彩评论

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