views:

23

answers:

2

Anyone have an idea how I can create a usercontrol that is only available inside the template of another user control? The best example I can think of is the PostBackTrigger and AsyncPostbackTrigger. These "controls" are only available inside the Triggers "template" of the UpdatePanel. Basically, I want to be able to include placeholder elements inside of the template that are then rendered into a seperate usercontrol using only the attributes assigned in the aspx portion of the page.

an example to try and make things more clear:

<usercontrol1>
    <mytemplate>
        <table>
            <tr>
                <td><usercontrol2 ID="uc2" runat="server" Text="Text" Width="200" />
            </tr>
        </table>
    </mytemplate>
</usercontrol1>

In this example, usercontrol2 would not show up in Intellisense unless I was typing inside usercontrol1's template.

+2  A: 

Sadly this cannot be done with User Controls. In order to do this you will have to build a templated server control.

Or using Templated User Controls per Kbrimington

Josh
Note also that a user control can be templated. (See: http://msdn.microsoft.com/en-us/library/36574bf6.aspx).
kbrimington
OK. Thanks for the quick reply.
Jason
@kbrimington Thanks for the update... I have included it in the answer for future reference.
Josh
A: 

Josh is correct.

alby1481
Completely pointless answer :)
Timwi