Dave Burke : Freelance .NET Web Developer specializing in Online Communities

VS.NET cannot open designer on .ASCX file open -- weird fix

I was experiencing this annoying message after I opened up a .ASCX file in VS.NET.  The source files for the usercontrols are all located in a reference project, and further, inherit from a basecontrol class.  The error message (rather small, sorry) is below.

What I did to fix it was to copy the designer component initialization code and page_load method into the base class.  Code below.  But here's the weird part:  I didn't want that code in my basecontrol (I'm using a pagetemplate approach which loads other controls dynamically), so after adding the code and seeing that it fixed the error, I deleted it.  I recompiled.  Closed VS.NET.  Went back into it, and it was still fixed.  I think it may have something to do with a setting in the .csproj file, which would explain why the error didn't reappear when I removed the code again.

private void Page_Load(object sender, System.EventArgs e) {}
override protected void OnInit(EventArgs e)
{
 InitializeComponent();
 base.OnInit(e);
}

private void InitializeComponent()
{  this.Load += new System.EventHandler(this.Page_Load); }

 

Comments (0) | Post RSS RSS comment feed

Posted on 4/21/2004 9:44:00 PM by Dave Burke
Categories:
Tags:

Related posts


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke