Can I create a usercontrol that is available only inside a template?
Anyone have an idea how I can create a usercontrol that is only avail开发者_如何学Pythonable 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.
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
精彩评论