You normally do not inherit a UserControl, because the code that adds the
controls in the *.ascx file is done using a Template in the UserControl
class. Something that you can do, however, is the following:
Create another UserControl and use your original UserControl in it
declaratively just like you would a Label or Image or other control that is
built into ASP.NET. If there is code in the codebehind that you want to use
in both UserControls, place that code in a separate.
If you want to include the UserControl in a CustomControl, simply add it
dynamically the same way you would for one of the controls built into
ASP.NET. For example:
Dim myctrl As New MyCtrl()
And then assign values to any of the properties. Hopefully this will help
you with your problem.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/ [quoted text, click to view] "Vikas Manghani" <VikasManghani@discussions.microsoft.com> wrote in message
news:C74FFD61-C4DF-4435-B3A5-43FB3D73EDB6@microsoft.com...
> Hi
> I have a base user control that is inherited from
> System.Web.UI.UserControl.
> It has a single button on it. I want to derive few other controls from
> this
> base user control.
> I am using Visual Studio 2005 (ASP.Net 2.0). But its not as simple as
> setting the right base classes for the code behind class and setting the
> Inherits attribute in the aspx page.
> If I create the usercontrol as a class in App_Code and inherit my classes
> from it, it works. The problem is that if the class is in App_Code I
> cannot
> have a UI to it, i.e. have a button on its surface.
> Can anyone tell me how do I do it?
>
> Thanks in advance
> Vikas Manghani
>