Hi,
ascx files aren't in the inheritance chain (assuming if I understand your
scenario correctly). If you put B to derive from A, it means B derives from
code-behind class of A, not the A.ascx being parsed through normal ASP.NET's
mechanisms (it is parsed dynamically or via Page.ParseControl/LoadControl
etc)
I think master pages would be closer solution to this.
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Ivan A. Vasilyev" <> wrote in message
news:...
> Hello.
>
> Could anyone please clarify one thing.
>
> Suppose I have to classes:
> 1. A inherits UserControl
> 2. B inherits A
>
> BOTH A AND B HAVE HTML MARKUP IN RELATED ASCX FILES.
>
> Then suppose I want to instantiate control B. I have three options:
> 1. Propgrammatically instatiate B through new B();
> 2. Propgrammatically instatiate B through LoadControl("B.ascx");
> 3. Declare control B in ASPX/ASCX of a container and refer B in
> code-behind file of a container.
>
> The quiestion is the following: Which of instantiation options are correct
> to use?
>
> I've tried (3) but it seems that html markup (in ASCX) of class A isn't
> being parsed, so those children of A (from ASCX) are not being created.
>
> TIA
>