Art Of Programming

musings by Dmytrii Nagirniak

Solve Designer Error in BDS 2006

Many of developers working with ASP.NET in design time saw the error: ”The designer could not be shown for this file because none of the classes within it can be designed”. I happens in Visual Studio and in Borland Developer Studio when a web page is inherited from some base class and not from default Page. Common actions to solve it are:
  1. Add public default constructor to base class.
  2. Add private InitializaComponent method to base.
  3. Call InitializaComponent from the default constructor.
But in BDS there’re some more issues.
Even after these steps it can still show the error. After I played with that I found that this error appears in following situation:
  1. Open web project.
  2. Default page is opening in design mode.
  3. If it has errors no one page that is inherited from some base class will open anymore.
Tho note: if base class will be changed to default one (Page), than designer successfully appears.
So, in a short, to make BDS working with base class in design time one of solutions is needed:
  • Add constructor, InitializaComponent method to base class. Then inherit default page from standard Page class. Other web forms should successfuly be available in designer.
  • If designer is required, temporary inherit from standard Page class.
That’s what I found.

Comments