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); }
