[已解决问题]
解决于 2008-04-09 20:22
VS2005在代码中指定母版页<br><b>分析器错误信息: </b>内容控件必须是内容页中的顶级控件,或是引用母版页的嵌套母版页。<br><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="test._default" %><br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br><br><html xmlns="http://www.w3.org/1999/xhtml" ><br><head runat="server"><br> <title>无标题页</title><br></head><br><body><br> <form id="form1" runat="server"><br> <div><br> <br><br><asp:Content ID="Content1" ContentPlaceHolderID="cphBody" Runat="Server"><br>AA</asp:Content> </div><br> <br> </form><br></body><br></html><br><br>using System;<br>using System.Data;<br>using System.Configuration;<br>using System.Collections;<br>using System.Web;<br>using System.Web.Security;<br>using System.Web.UI;<br>using System.Web.UI.WebControls;<br>using System.Web.UI.WebControls.WebParts;<br>using System.Web.UI.HtmlControls;<br>using System.Threading;<br>using System.Text.RegularExpressions;<br>using System.Globalization;<br>namespace test<br>{<br> public partial class _default : System.Web.UI.Page<br> {<br> protected void Page_Load(object sender, EventArgs e)<br> {<br> <br> }<br> protected void Page_PreInit(object sender, EventArgs e)<br> {<br> string _Theme = "tfr";<br> MasterPageFile = RelativeWebRoot + "themes/" + _Theme + "/site.master";<br><br> }<br> <br> public string RelativeWebRoot<br> {<br> get { return VirtualPathUtility.ToAbsolute(ConfigurationManager.AppSettings["BlogEngine.VirtualPath"]); }<br> }<br> }<br>}<br><br>
问题补充:
备注:是通过编程方式来指定母版,不是在建立aspx时,直接选择.
我是想通过母版,来实现不同的皮肤
编程入门
|
初学一级
|
园豆:
185
提问于:2008-03-26 16:41