且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是占位符和ContentPlaceHolder?

更新时间:2023-11-29 16:04:40

PlaceHolder:它用于动态在网页上添加控件。 [ ^ ]示例显示如何使用它。



ContentPlaceHolder:它在母版页中用于定义将在运行时由内容页面填充的区域。 [ ^ ]示例显示如何使用它。


PlaceHolder控件用作要添加的任何控件的容器并可以在任何页面上使用。 ContentPlaceHolder用于保存内容页面中的内容,只能在母版页上使用。



在此查看有关MSDN的文档:



http://msdn.microsoft .com / zh-cn / library / system.web.ui.webcontrols.contentplaceholder.aspx [ ^ ]



http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols。 placeholder.aspx [ ^ ]

What is placeholder and ContentPlaceHolder??
And when are thsese used in Web pages

PlaceHolder: It is used to dynamically add controls on a web page. This[^] example shows how to use it.

ContentPlaceHolder: It is used in master pages to define the area that will be filled by content pages at runtime. This[^] example shows how to use it.


A PlaceHolder control is used as a container for any controls you wish to add and can be used on any page. A ContentPlaceHolder is used to hold content from Content Pages and can only be used on a Master Page.

Look here for documentation on MSDN:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.contentplaceholder.aspx[^]

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.placeholder.aspx[^]