2012-07-25 54 views
0

在我的主要主网页我有:如何在嵌套母版页中使用控件?

<html> 
<head runat="server"> 
    <title>Master Page</title> 
</head> 
<body> 
    <form runat="server"> 
    <div> 
    <table cellpadding="0" cellspacing="0" style="width: 100%"> 
    <tr> 
    <td align="center"> 
     <img src="images/download.jpg" alt="manipallogo" /> 
    </td> 
    <td align="center" valign="middle"> 
     <h2 style="font-style:normal;font-size:x-large">Mobility Sanjivini</h2> 
    </td> 
    <td align="center"> 
     <img src="images/philips.jpg" alt="philipslogo" 
          height="84" width="170" /> 
    </td> 
    </tr> 
    <tr> 
    <td colspan="1"> 
     <asp:ContentPlaceHolder runat="server" ID="cntplace1"> 
     </asp:ContentPlaceHolder> 
    </td> 
    <td colspan="2"> 
    <asp:ContentPlaceHolder runat="server" ID="ContentPlaceHolder2"> 
    </asp:ContentPlaceHolder> 
    </td> 
    </tr> 


    </table> 
    </div> 
    </form> 
</body> 
</html> 

嵌套桅页:

<asp:Content ID="Content1" ContentPlaceHolderID="cntplace1" Runat="Server"> 
    <table width="100%"> 
     <tr> 
     <td> 
      <asp:Label runat="server" ID="lblImmu" Text="Immunization Details"> 
      </asp:Label> 
     </td> 
     </tr> 
     <tr> 
     <td> 
      <asp:Label runat="server" ID="lblDel" Text="Immunization Details"> 
      </asp:Label> 
     </td> 
     </tr> 
     <tr> 
     <td> 
      <asp:Label runat="server" ID="lblMal" Text="Immunization Details"> 
      </asp:Label> 
     </td> 
     </tr> 
    </table> 
</asp:Content> 

但是当我运行,则不会显示嵌套页标签。请有人告诉我我哪里错了。

+0

我看不出你目前有什么问题。你能否确认在使用NESTED母版页**的页面**中,你也没有''? – freefaller 2012-07-25 13:41:53

回答

0

asp:content正在与ContentPlaceholderID属性对齐。所以你必须将它添加到你的母版页中:

<asp:ContentPlaceHolder runat="server" ID="cntplace1" ContentPlaceholderID="cntplace1"></asp:ContentPlaceHolder></td> 
+0

我正在添加我的母版页 – Aada 2012-07-25 13:40:59

相关问题