我在asp页面中实现bootstrap时遇到了一些问题。如何获取我的Navbar右侧的asp主页面的ContentPlaceHolder?
母版页:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="WebApplication1.Main" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="Content/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="Content/bootstrap-theme.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://getbootstrap.com/examples/dashboard/#">Project name</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="http://getbootstrap.com/examples/dashboard/#">Dashboard</a></li>
<li><a href="http://getbootstrap.com/examples/dashboard/#">Settings</a></li>
<li><a href="http://getbootstrap.com/examples/dashboard/#">Profile</a></li>
<li><a href="http://getbootstrap.com/examples/dashboard/#">Help</a></li>
</ul>
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Search...">
</form>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active"><a href="http://getbootstrap.com/examples/dashboard/#">Overview</a></li>
<li><a href="http://getbootstrap.com/examples/dashboard/#">Reports</a></li>
<li><a href="http://getbootstrap.com/examples/dashboard/#">Analytics</a></li>
<li><a href="http://getbootstrap.com/examples/dashboard/#">Export</a></li>
</ul>
<ul class="nav nav-sidebar">
<li><a href="">Nav item</a></li>
<li><a href="">Nav item again</a></li>
<li><a href="">One more nav</a></li>
<li><a href="">Another nav item</a></li>
<li><a href="">More navigation</a></li>
</ul>
</div>
</div>
</div>
<div class="Container">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<script src="Scripts/jquery.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
</body>
</html>
这会将内容置于导航栏下,如下所示:
我需要知道在哪里实现ContentPlaceHolder。
答案 0 :(得分:1)
将<div class="Container">
换入上述<div class="container-fluid">
如果需要,还可以从col-sm-offset-X
删除ContentPlaceHolder1
。
这是一个有效的 DEMO