开发者

Nested User Controls - where to start?

开发者 https://www.devze.com 2023-03-08 04:50 出处:网络
<uc:Tabs runat=\"server\"> <uc:ControlA runat=\"server\" /> <uc:ControlB runat=\"server\" />
<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="开发者_StackOverflowserver" />
            </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.

0

精彩评论

暂无评论...
验证码 换一张
取 消