Hi,
I am working on ASP.NET 2.0 with the C# as code behind.
I have a baseControl.ascx.cs which will have properties and some methods.Then I have childControl.ascx.cs which inherits from the baseControl.
Public partial class childControl : baseControl
Both user controls are in the same namespace. When I build those user controls, it returns me error saying that the type or namespace baseControl cannot be found().
I would like to know is it possible to inherit user control? Will it be possible if I declared the baseControl as an abstract class since I want to have some abstract methods in that class?
Thanks.
![]() |
0 |
![]() |
That's due to the new Web Project scheme in ASP.NET 2.0. I haven't quite figured it out entirely but I do know of one quick way if you don't need to define a template for your user control. Create a new class that inherits from User Control(as a pure CS file...not as a User Control you selected to add a new item) and put it in the App_Code folder(create it if you haven't yet...it's a default ASP.NET folder you can select). Put all of the base control logic there. The base class should now be accessible to your user controls.
But that's only if your base control doesn't define any template...
![]() |
0 |
![]() |