博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

ASP.Net 2.0 C# 选项卡效果

Posted on 2008-07-01 21:54  小伟不笨  阅读(1658)  评论(0编辑  收藏  举报

页面代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Htgl_DataAdmin_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    <asp:Menu ID ="Menu1" Width="168px" runat ="server" Orientation="horizontal" StaticEnableDefaultPopOutImage="false" OnMenuItemClick ="Menu1_MenuItemClick">
    <Items >
    <asp:MenuItem Text ="Tab1" Value ="0"></asp:MenuItem>
    <asp:MenuItem   Text ="Tab2" Value ="1"></asp:MenuItem>
    <asp:MenuItem   Text ="Tab3" Value ="2"></asp:MenuItem>
    </Items>
    </asp:Menu>
    <asp:MultiView ID ="MultiView1" runat ="server" ActiveViewIndex ="0">
    <asp:View ID ="Tab1" runat ="server" >
    <table style ="width :600px; height:400px;" cellpadding ="0" cellspacing ="0">
    <tr valign ="top">
    <td class ="TabArea" style ="width:600px">
    TAB VIEW 4
INSERT YOUR CONENT IN HERE
CHANGE SELECTED IMAGE URL AS NECESSARY
    </td>
    </tr>
    </table>
    </asp:View>
    <asp:View ID ="Tab2" runat ="server" >
    <table style ="width :600px; height :400px;" cellpadding ="0" cellspacing ="0">
    <tr valign ="top" >
    <td class ="TabArea" style ="width :600px">
    TAB VIEW 2
INSERT YOUR CONENT IN HERE
CHANGE SELECTED IMAGE URL AS NECESSARY
    </td>
    </tr>
    </table>
    </asp:View>
    <asp:View ID ="Tab3" runat="server" >
    <table style =" width:600px; height :400px" cellpadding ="0" cellspacing ="0">
    <tr valign ="top">
    <td class ="TabArea" style ="width :600px">
        TAB VIEW 54INSERT YOUR CONENT IN HERE
CHANGE SELECTED IMAGE URL AS NECESSAR
    </td>
    </tr>
    </table>
    </asp:View>
    </asp:MultiView>
    </div>
    </form>
</body>
</html>

 

C#代码:

protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
    {
        MultiView1.ActiveViewIndex = Convert.ToInt32(Menu1.SelectedValue);
       

    }