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:
Even after these steps it can still show the error. After I played with that I found that this error appears in following situation:
So, in a short, to make BDS working with base class in design time one of solutions is needed:
- Add public default constructor to base class.
- Add private InitializaComponent method to base.
- Call InitializaComponent from the default constructor.
Even after these steps it can still show the error. After I played with that I found that this error appears in following situation:
- Open web project.
- Default page is opening in design mode.
- If it has errors no one page that is inherited from some base class will open anymore.
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.