C# 如何在asp.net 2010 web应用程序中为已定义的web表单创建母版页

C# 如何在asp.net 2010 web应用程序中为已定义的web表单创建母版页,c#,asp.net,C#,Asp.net,我在我的项目中有登录、注册和欢迎web表单,这些表单是设计和编码的 现在我要为这个项目创建一个母版页 如何在web应用程序中为这3个表单创建母版页 我只知道先创建母版页,然后使用母版页选择web表单这个概念我很清楚 但是我想为这个已经设计好的web表单创建一个母版页 我该怎么做?谁能帮我 欢迎您谦恭的回复。。。。。。。。。。。。 谢谢你 一般来说,我只能说你。作为一名网络开发人员,你必须清楚这些基本的事情 我不会描述你是如何创建母版页的——你说过你已经知道了 但要将现有页面移动到其中,您应该:

我在我的项目中有登录、注册和欢迎web表单,这些表单是设计和编码的 现在我要为这个项目创建一个母版页

如何在web应用程序中为这3个表单创建母版页

我只知道先创建母版页,然后使用母版页选择web表单这个概念我很清楚

但是我想为这个已经设计好的web表单创建一个母版页

我该怎么做?谁能帮我

欢迎您谦恭的回复。。。。。。。。。。。。 谢谢你

一般来说,我只能说你。作为一名网络开发人员,你必须清楚这些基本的事情

我不会描述你是如何创建母版页的——你说过你已经知道了

但要将现有页面移动到其中,您应该:

  • 在页眉中添加对它的引用:

    <%@ Page ... MasterPageFile="~/PathToThePage/YourMasterPage.master" ... %>
    
    
    
  • 然后使用asp:Content块将子页面的html放入母版页中定义的块中:

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentHeader" runat="Server">
        some parts of child page
    </asp:Content>
    
    <asp:ContentPlaceHolder ID="ContentHeader" runat="server">
        Some part which will be replaced with child page
    </asp:ContentPlaceHolder>
    
    
    子页面的某些部分
    
ContentPlaceHolder ID=“ContentHeader”-这是您在母版页中定义的ContentPlaceHolder:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentHeader" runat="Server">
    some parts of child page
</asp:Content>
<asp:ContentPlaceHolder ID="ContentHeader" runat="server">
    Some part which will be replaced with child page
</asp:ContentPlaceHolder>

将替换为子页面的某些部分
一般来说,我只想说你。作为一名网络开发人员,你必须清楚这些基本的事情

我不会描述你是如何创建母版页的——你说过你已经知道了

但要将现有页面移动到其中,您应该:

  • 在页眉中添加对它的引用:

    <%@ Page ... MasterPageFile="~/PathToThePage/YourMasterPage.master" ... %>
    
    
    
  • 然后使用asp:Content块将子页面的html放入母版页中定义的块中:

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentHeader" runat="Server">
        some parts of child page
    </asp:Content>
    
    <asp:ContentPlaceHolder ID="ContentHeader" runat="server">
        Some part which will be replaced with child page
    </asp:ContentPlaceHolder>
    
    
    子页面的某些部分
    
ContentPlaceHolder ID=“ContentHeader”-这是您在母版页中定义的ContentPlaceHolder:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentHeader" runat="Server">
    some parts of child page
</asp:Content>
<asp:ContentPlaceHolder ID="ContentHeader" runat="server">
    Some part which will be replaced with child page
</asp:ContentPlaceHolder>

将替换为子页面的某些部分