2017-07-26 39 views
1

我很難將asp.net site.mobile.master頁面集成到我的asp.net應用程序中。具體來說,我看到在jsFiddle中工作的導航欄沒有正確顯示。Navbar問題asp.net site.mobile.master

<nav class="navbar navbar-default navbar-inverse" role="navigation"> 
     <div class="container-fluid" id="navfluid"> 
      <div class="navbar-header"> 
       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> 
        <span class="icon-bar"></span> 
        <span class="icon-bar"></span> 
        <span class="icon-bar"></span> 
       </button> 
       <a class="navbar-brand" href="Home">Home</a> 
      </div> 
      <div class="collapse navbar-collapse"> 
       <ul class="nav navbar-nav"> 
        <li class="active"><a href="#">Home</a></li> 
        <li><a href="Page1">Page1</a></li> 
        <li><a href="Page2">Page2</a></li> 
       </ul> 
      </div> 
     </div> 
    </nav> 

回答

0

我提供的代碼有效!它必須添加腳本,以便asp.net模板自動添加到master.site頁面,但不添加到master.mobile.site頁面。由於我剛剛接觸asp.net,這讓我花了很多時間來實現,所以我希望這可以幫助別人!在表單標記下方添加以下代碼。

<asp:ScriptManager runat="server"> 
     <Scripts> 
      <%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%> 
      <%--Framework Scripts--%> 
      <asp:ScriptReference Name="MsAjaxBundle" /> 
      <asp:ScriptReference Name="jquery" /> 
      <asp:ScriptReference Name="bootstrap" /> 
      <asp:ScriptReference Name="respond" /> 
      <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" /> 
      <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" /> 
      <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" /> 
      <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" /> 
      <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" /> 
      <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" /> 
      <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" /> 
      <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" /> 
      <asp:ScriptReference Name="WebFormsBundle" /> 
      <%--Site Scripts--%> 
     </Scripts> 
    </asp:ScriptManager> 

此外,一定要加標題下面這一權利:

enter cod<asp:PlaceHolder runat="server"> 
    <%: Scripts.Render("~/bundles/modernizr") %> 
</asp:PlaceHolder> 

<webopt:BundleReference runat="server" Path="~/Content/css" />