2017-07-26 74 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" />