试着在ASP:NET模仿做一个TABCONTROL的控件代码如下:
<head id="Head1" runat="server">
    <style type="text/css">
        html
        {
        }
        .tabs
        {
            position:static ;
            top:1px;
            left:0px;
            background-color:Blue ;
        }
        .tab
        {
            border:solid 1px black;
            background-color:Yellow;
            padding:2px 10px;
        }
        .selectedTab
        {
            border-bottom:solid 1px white;
        }
        .tabContents
        {
            border:solid 0px black;
            padding:10px;
            background-color:white;
        }
    </style>
    <title>MultiView Tabs</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    <asp:Menu
        id="Menu1"
        Orientation="Horizontal"
        StaticMenuItemStyle-CssClass="tab"
        StaticSelectedStyle-CssClass="selectedTab"
        CssClass="tabs"
        Runat="server">
<StaticSelectedStyle CssClass="selectedTab"></StaticSelectedStyle><StaticMenuItemStyle CssClass="tab"></StaticMenuItemStyle>
        <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>
    
    <div class="tabContents">
    <asp:MultiView
        id="MultiView1"
        ActiveViewIndex="0"
        Runat="server">
        <asp:View ID="View1" runat="server">
            <br />This is the first view
            <br />This is the first view
            <br />This is the first view
            <br />This is the first view
        </asp:View>        
        <asp:View ID="View2" runat="server">
            <br />This is the second view
            <br />This is the second view
            <br />This is the second view
            <br />This is the second view
        </asp:View>        
        <asp:View ID="View3" runat="server">
            <br />This is the third view
            <br />This is the third view
            <br />This is the third view
            <br />This is the third view
        </asp:View>        
    </asp:MultiView>
    </div>
    
    </div>
    <asp:Button ID="Button1" runat="server" Text="Button" />
    </form>
</body>

解决方案 »

  1.   

    1)---在VB代码设置画面LOAD的时候,
    item(1)及item(2)不可用。
     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Menu1.Items(1).Enabled = False
            Menu1.Items(2).Enabled = False
    End Sub2)---BUTTON按钮执行完成后,将item(1)/item(2)开放出来。
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
            Menu1.Items(1).Enabled = True
            Menu1.Items(2).Enabled = True
    End Sub3)---单击item(1)或者item(2)时出现ERROR说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidOperationException: 无法选择被禁用或不可选择的菜单项。
    望高手指点