VS2005中显示使用嵌套母版的设计视图

在VS2005中, 如果你的站点使用了嵌套母版,那么在设计一些使用这些嵌套母版的页面时,IDE默认的设置是只能使用源视图,而如果对于一些数据控件,就无法使用其智能标签了。所以,可以通过以下方法显示页面的设计视图。(如果你使用的VS2008,不存在这个问题)。

首先定义一个类:

BasePage.cs

using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;

/// <summary> /// Summary description for BasePage /// </summary> public class BasePage : System.Web.UI.Page {     private string runtimeMasterPageFile;

    public string RuntimeMasterPageFile     {         get         {             return runtimeMasterPageFile;         }         set         {             runtimeMasterPageFile = value;         }     }

    protected override void OnPreInit(EventArgs e)     {         if (runtimeMasterPageFile != null)         {             this.MasterPageFile = runtimeMasterPageFile;         }             base.OnPreInit(e);     } }

 

然后可以使你的使用嵌套母版的页面的页面指令中,做如下声明:

<%@ Page Language="C#" MasterPageFile="" RuntimeMasterPageFile="~/UserLogedMasterPage.master" CodeFileBaseClass="BasePage" AutoEventWireup="true" CodeFile="Select.aspx.cs" Inherits="commonuser_Select" Title="交费记录查询" %>

注意:有一个MasterPageFile,值为空,还有一个RuntimeMasterPageFile,值是嵌套母版页。同时,还要让你的页面类继承自:BasePage,如:

public partial class commonuser_Select : BasePage

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值