日期:2014-05-17  浏览次数:20342 次

母版页中的内容显示不了,急!在线,马上给分
第一次用母版就出了问题,开发环境vs2005
母版页的代码:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MP1.master.cs" Inherits="MP1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title>无标题页</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
  <asp:TextBox ID="TextBox2" runat="server">这是个文本框</asp:TextBox>
  测试母版的内容<asp:Image ID="Image1" runat="server" ImageUrl="~/pic/xm.jpg" /></asp:contentplaceholder>
  </div>
  </form>
</body>
</html>

内容页的代码:
<%@ Page Language="C#" MasterPageFile="~/MP1.master" AutoEventWireup="true" CodeFile="TryMp.aspx.cs" Inherits="TryMp" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  <asp:TextBox ID="TextBox1" runat="server">这是内容页</asp:TextBox>
  <asp:Button ID="Button1" runat="server" Text="Button" />
</asp:Content>

在浏览器中浏览内容页trymp.aspx时,只显示内容页的东西,而母版页的内容一点都不显示!!求教


------解决方案--------------------
母版页里的东西不要放到contentplaceholder里面,放到外面去。