我在asp.net的视觉工作室上课了,我在这个母版页上难过,请帮助我。我无法将默认页面链接到母版页我不确定
默认页码
<%@ Page Title="" Language="C#" MasterPageFile="" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AdrianASP2012.WebForm2" %>
<div>
<h2>Nulla luctus eleifend</h2>
<p>This is <strong>Greenness </strong>, a free, fully standards-compliant CSS template designed by <a href="http://www.freecsstemplates.org">FCT</a>. The photos in this template are from <a href="http://fotogrph.com/"> Fotogrph</a>. This free template is released under a <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attributions 3.0</a> license, so you are pretty much free to do whatever you want with it (even use it commercially) provided you keep the links in the footer intact. Aside from that, have fun with it :) </p>
<p> </p>
<p>Maecenas pede nisl, elementum eu, ornare ac, malesuada at, erat. Proin gravida orci porttitor enim accumsan lacinia. Donec condimentum, urna non molestie semper, ligula enim ornare nibh, quis laoreet eros quam eget ante. Aliquam libero. Vivamus nisl nibh, iaculis vitae, viverra sit amet, ullamcorper vitae, turpis. Aliquam erat volutpat. Vestibulum dui sem, pulvinar sed, imperdiet nec, iaculis nec, leo. Fusce odio. Etiam arcu dui, faucibus eget, placerat vel, sodales eget, orci. Donec ornare neque ac sem. Mauris aliquet. </p>
<p class="button-style"><a href="#">More Details</a></p>
</div>
和母版页主体部分是
<body>
<form id="form1" runat="server">
<div id="header">
<div id="logo">
<h1><a href="#">Greenness</a></h1>
</div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="#" accesskey="1" title="">Homepage</a></li>
<li><a href="#" accesskey="2" title="">Our Clients</a></li>
<li><a href="#" accesskey="3" title="">About Us</a></li>
<li><a href="#" accesskey="4" title="">Careers</a></li>
<li><a href="#" accesskey="5" title="">Contact Us</a></li>
</ul>
</div>
</div>
<div id="banner-wrapper">
<div id="banner">
<img src="App_Themes/Theme1/images/pics01.jpg" width="1000" height="345" alt="" />
</div>
</div>
<div id="page-wrapper">
<div id="page">
<div id="content">
<!-- CONTENT PLACE HOLDER HERE -->
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server"></asp:ContentPlaceHolder>
</div>
<div id="sidebar">
<h2>Maecenas lectus</h2>
<ul class="style1">
<li class="first">
<p><a href="#">Aliquam erat volutpat. Pellentesque tristique ante ut risus. Quisque dictum. Integer nisl risus, sagittis convallis, rutrum congue.</a></p>
</li>
<li>
<p><a href="#">Aliquam erat volutpat. Pellentesque tristique ante ut risus. Quisque dictum. Integer nisl risus, sagittis convallis, rutrum congue.</a></p>
</li>
<li>
<p><a href="#">Aliquam erat volutpat. Pellentesque tristique ante ut risus. Quisque dictum. Integer nisl risus, sagittis convallis, rutrum congue.</a></p>
</li>
</ul>
</div>
</div>
</div>
<div id="footer-wrapper">
<div id="footer-content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<div id="fbox2">
<h2><span>Fusce ultrices</span> fringilla</h2>
<p>
<img src="App_Themes/Theme1/images/img05.jpg" width="320" height="150" alt="" />
</p>
<p>Aliquam erat volutpat. Pellentesque tristique ante ut risus. Quisque dictum. Integer nisl risus, sagittis convallis, rutrum id, elementum congue, nibh. Donec leo, vivamus fermentum nibh in augue praesent a lacus at urna congue rutrum elementum congue.</p>
<p class="button-style"><a href="#">More Details</a></p>
</div>
<div id="fbox3">
<h2><span>Mauris vulputate</span> scelerisque</h2>
<ul class="style3">
<li class="first">
<img src="App_Themes/Theme1/images/img02.jpg" width="78" height="78" alt="">
<p>Nullam non wisi a sem eleifend. Donec mattis libero eget urna. </p>
<p class="posted">August 11, 2002 | (10 ) Comments</p>
</li>
<li>
<img src="App_Themes/Theme1/images/img03.jpg" width="78" height="78" alt="">
<p>Nullam non wisi a sem eleifend. Donec mattis libero eget urna. </p>
<p class="posted">August 11, 2002 | (10 ) Comments</p>
</li>
<li>
<img src="App_Themes/Theme1/images/img04.jpg" width="78" height="78" alt="">
<p>Nullam non wisi a sem eleifend. Donec mattis libero eget urna. </p>
<p class="posted">August 11, 2002 | (10 ) Comments</p>
</li>
</ul>
</div>
</div>
</div>
<div id="footer">
</form>
</body>
答案 0 :(得分:1)
考虑改变:
MasterPageFile=""
到您的母版页的名称。典型地:
MasterPageFile="~/MasterPage.master"
答案 1 :(得分:1)
在您的default.aspx中,MasterPageFile
值为空。因此,将其更改为您的母版页文件名。
MasterPageFile="<place master page path>"
MasterPageFile="~/Custom/UI/Templates/MasterPage.master"
提示:将光标放在“”(MasterPageFile =“|”)之间,然后按Ctrl +空格键进行智能处理,您将获得"Pick Master..."
并单击以选择母版页。
答案 2 :(得分:1)
首先在MasterPageFile =“〜/ YourMasterPage.master”中提供MasterPageFile名称 其次,您必须在内容占位符内编写代码..