2016-11-07 48 views
0

我在asp.net中有一个母版页。引导程序不在asp.net主页面中应用

下面是完整的.aspx文件。

使用bootstrap将CSS添加到div标记。所有链接都给出。

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="apage.master.cs" Inherits="Website.apage" %> 

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head id="Head1" runat="server"> 
    <title></title> 

    <asp:ContentPlaceHolder ID="head" runat="server"> 

     <link href="Content/bootstrap.css" rel="stylesheet" /> 
     <link href="Content/bootstrap.min.css" rel="stylesheet" /> 
     <script src="Scripts/jquery-3.1.1.min.js"></script> 
     <script src="Scripts/bootstrap.js"></script> 
     <script src="Scripts/bootstrap.min.js"></script> 
    </asp:ContentPlaceHolder> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
     <div id="Panel_Main" style="box-shadow: 0 0 02px blue;" class="panel panel-primary"> 

      <div id="Panel_Heading" class="panel-heading"> 
       <table style="width: 100%;"> 
        <tr> 
         <td> 
          <div class="text-left"> 
           <h4 style="font-family: Calibri; font-size: xx-large; font-weight: normal; font-style: normal; font-variant: normal; color: #FFFFFF">MyWebsite</h4> 

          </div> 
         </td> 

        </tr> 
       </table> 
      </div> 
          <asp:ContentPlaceHolder ID="childContainer" runat="server"> 
          </asp:ContentPlaceHolder> 
     </div> 
    </form> 
</body> 
</html> 

我想运行一个子页面。但css不适用于浏览器。

我有另一个masterpage相同的配置工作正常。但是对于这个页面,css不适用。

我在这里错过了什么。

任何帮助表示赞赏。

回答

3

尝试这个

你所有的脚本&所有的JS写外ASP:的ContentPlaceHolder

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head id="Head1" runat="server"> 
    <title></title> 

    <asp:ContentPlaceHolder ID="head" runat="server"> 

    </asp:ContentPlaceHolder> 

     <link href="Content/bootstrap.css" rel="stylesheet" /> 
     <link href="Content/bootstrap.min.css" rel="stylesheet" /> 
     <script src="Scripts/jquery-3.1.1.min.js"></script> 
     <script src="Scripts/bootstrap.js"></script> 
     <script src="Scripts/bootstrap.min.js"></script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
     <div id="Panel_Main" style="box-shadow: 0 0 02px blue;" class="panel panel-primary"> 

      <div id="Panel_Heading" class="panel-heading"> 
       <table style="width: 100%;"> 
        <tr> 
         <td> 
          <div class="text-left"> 
           <h4 style="font-family: Calibri; font-size: xx-large; font-weight: normal; font-style: normal; font-variant: normal; color: #FFFFFF">MyWebsite</h4> 

          </div> 
         </td> 

        </tr> 
       </table> 
      </div> 
          <asp:ContentPlaceHolder ID="childContainer" runat="server"> 
          </asp:ContentPlaceHolder> 
     </div> 
    </form> 
</body> 
</html> 
+0

大。工作。谢谢:) –

+1

只需要注意一点,它在子页面上运行的任何JQuery脚本之上设置的方式将不起作用,因为内容占位符在脚本声明之前,即在引用加载之前将使用JQuery。 始终在头部的内容占位符之前加载您的母版页脚本 – ThatChris

相关问题