简体   繁体   English

嵌套用户控件 - 从哪里开始?

[英]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.我正在尝试构建一个“Tabs”用户控件,它将收集嵌套在自身内部的所有控件并将它们包装在一组特定的 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.我想我可以使用asp:Menuasp:MultiView并用适当的类包装它们。

Wish I could remove the auto generated css that asp:Menu puts into the <head> though.希望我可以删除 asp:Menu 放入<head>的自动生成的 css 。 Any idea how to do that?知道怎么做吗?

Here is an MSDN VB solution which could be easily translated to C#.这是一个 MSDN VB 解决方案,可以轻松转换为 C#。

http://support.microsoft.com/kb/319100 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.但是,根据您要完成的工作,这听起来可能是您尝试做的事情的过度复杂或过度杀伤的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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