Linux 拨号vps windows公众号手机端

asp中ContentPlaceHolderID属性怎么使用

lewis 7年前 (2018-06-11) 阅读数 9 #程序编程
文章标签 asp

在ASP中,ContentPlaceHolderID属性用于指定一个控件或者页面元素要放置在主内容页面中的位置。

使用方法如下:

  1. 在主内容页面(通常是MasterPage.master)中,使用<asp:ContentPlaceHolder>标签定义一个占位符,指定一个唯一的ID属性值,如:
<asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
  1. 在子页面(通常是Default.aspx)中,使用<asp:Content>标签指定ContentPlaceHolderID属性值为主内容页面中的占位符ID,如:
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<!-- 这里是子页面的内容 -->
</asp:Content>

这样,子页面中的内容将会被放置在主内容页面的ContentPlaceHolder所指定的位置处。

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门