开发者

Creating web controls inside a content placeholder programmatically

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜