我的所有的Page都是继承自一个Abstract的基页面(BasePage.aspx)。可是继承了以后运行一次以后页面就不能进入Designer状态了,只能够看到页面的Asp.net代码。提示如下(由于是日语的,因此只能是一个意思的翻译):Web Form设计窗口不能读取,以下的错误修正后请再读入。Abstract 型请确认该WebForm使用的所有class都在project内编译(build)或者被引用。
详细情况,点击Help按钮。

解决方案 »

  1.   

    我的所有的Page都是继承自一个Abstract的基页面(BasePage.aspx)。
    ----
    我目前的项目也是这样做的,没问题,可能是你的BasePage类没写好,愿意的话贴一下代码
      

  2.   

    BasePage类,注释是日 语的。希望高手指点。namespace Disco.Common.Web.UI {
    using System;
    using System.Collections;
    using System.Collections.Specialized;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    abstract public class BasePage : System.Web.UI.Page { public NameValueCollection InputParameter {
    get {
    return (NameValueCollection)ViewState["InputParameter"];
    }
                
    set {
    ViewState["InputParameter"] = value;
    }

    override protected void OnInit(EventArgs e) {
    this.Load += new System.EventHandler(this.Page_Load);
    this.Error += new System.EventHandler(this.Page_Error);
    this.SetEventHandler();
    base.OnInit(e);
    this.InitPage();

    protected void Page_Load(object sender, System.EventArgs e) {

    if(this.IsPostBack) {
    this.ConvertTextBox(this);
    this.PostBack();
    } else {
    if(this.Context.Handler.GetType().Equals(this.GetType())
    && this.IsStartPage == false) {
    throw new PageException("不正なページにアクセスしました。","W00001",false);
    } else {
    if(this.Context.Items.Contains("FormParameter")) {
    this.InputParameter = (NameValueCollection)this.Context.Items["FormParameter"];
    this.FirstAccess(this.InputParameter);
    } else {

    this.FirstAccess();
    }
    }
    }
    }  protected void Page_Error(object sender,System.EventArgs e){
    }

    protected void Transfer(string path,NameValueCollection formParam) {
    if(formParam != null) {
    this.Context.Items.Add("FormParameter",formParam);
    }
    Server.Transfer(path);


    private void ConvertTextBox(Control con) {
    if(con.HasControls()){
    IEnumerator controlEnum = con.Controls.GetEnumerator();
    while(controlEnum.MoveNext()) {
    ConvertTextBox((Control)controlEnum.Current);
    }
    } else {
    if(con is TextBox) {
    ((TextBox)con).Text = ((TextBox)con).Text.Trim();
    ((TextBox)con).Text = ((TextBox)con).Text.Replace("'",string.Empty);
    ((TextBox)con).Text = Server.HtmlEncode(((TextBox)con).Text);
    }
    }

    virtual protected void SetEventHandler(){}

    virtual protected void InitPage(){} virtual protected void FirstAccess(){}

    virtual protected void FirstAccess(NameValueCollection param){} virtual protected void PostBack(){}

    abstract protected bool IsStartPage{get;} }
    }
      

  3.   

    对不起,麻烦复制下来看一下,页面Copy的时候排版很难控制。代码看起来太乱了。希望原谅。希望高手指点。谢谢
      

  4.   

    不要用abstract,因为asp.net页面在design的时候,需要用反射实例化基类的另外在使用basepage类之前,先编译以下你的工程,否则也会出现你上述的问题
      

  5.   

    你应该写一个继承System.Web.UI.Page的类(BasePage.cs),而不是abstract的BasePage.aspx
      

  6.   

    可能是以下几个方面的问题:
    1、页面基类应该是BasePage.cs 文件而不是BasePage.aspx文件。
    2、页面的直接基类不能是抽象类,根据你的代码分析,你的这个抽象基类文件定义的没错,但是页面不是直接从这个基类继承,我估计在此之外还定义了的一实体类,该实体类继承于该抽象基类,你们的web 页面再继承于实体类,这样运行起来就没有问题了。