简体   繁体   中英

Nested User Controls - where to start?

<uc:Tabs runat="server">
    <uc:ControlA runat="server" />
    <uc:ControlB runat="server" />
    <uc:ControlC runat="server" />
</uc:Tabs>

I'm trying to build a "Tabs" user control that will gather all of the controls nested within itself and wrap them in a specific set of html. Each nested user control should display normally. Any pointers to where I might begin?

Edit:

        <asp:Menu
            id="Menu1"
            StaticMenuItemStyle-CssClass="tab"
            StaticSelectedStyle-CssClass="selectedTab"
            CssClass="tabs"
            OnMenuItemClick="Menu1_MenuItemClick"
            Runat="server">
            <Items>
            <asp:MenuItem Text="Tab 1" Value="0" Selected="true" />
            <asp:MenuItem Text="Tab 2" Value="1" />
            <asp:MenuItem Text="Tab 3" Value="2" />
            </Items>    
        </asp:Menu>

        <asp:MultiView ID="MultiView1" ActiveViewIndex="0" runat="server">
            <asp:View ID="View1" runat="server">
                <hi5:GameInfo runat="server" />
            </asp:View>
            <asp:View ID="View2" runat="server">
                <hi5:GamePlayerInfo runat="server" />
            </asp:View>
            <asp:View ID="View3" runat="server">
                <hi5:GuildInfo runat="server" />
            </asp:View>
        </asp:MultiView>

I guess I could use asp:Menu and asp:MultiView and wrap each with the appropriate classes.

Wish I could remove the auto generated css that asp:Menu puts into the <head> though. Any idea how to do that?

Here is an MSDN VB solution which could be easily translated to C#.

http://support.microsoft.com/kb/319100

However depending on what you are trying to accomplish, this sounds like it may be an overcomplicated or overkill solution for what you are trying to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM