<!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 id="Head1" runat="server">
<title>Tab后台CS程序实现</title>
<style type="text/css">
body
{
color: #000000;
background-color: #ffffff;
font-family: Tahoma, 宋体;
font-size: 12px;
margin: 0px;
padding: 0px;
text-align: center;
}
#TabButton1, #TabButton2, #TabButton3
{
margin-top: 20px;
width: 60px;
}
.aaa
{
background-color: #E0E0E0;
}
.bbb
{
background-color: Gray;
color: White;
}
#tab1, #tab2, #tab3
{
width: 188px;
height: 100px;
background-color: #E0E0E0;
overflow: auto;
}
#tab2, #tab3
{
display: none;
}
</style>
</head>
<body>
<form id="form1" runat="Server">
<center>
<div>
<asp:Button ID="TabButton1" runat="server" CssClass="aaa" Text="查询" OnClick="TabButton1_Click" />
<asp:Button ID="TabButton2" runat="server" CssClass="bbb" Text="新建" OnClick="TabButton2_Click" />
<asp:Button ID="TabButton3" runat="server" CssClass="bbb" Text="修改" OnClick="TabButton3_Click" />
</div>
<div id="tab1" runat="Server">
<asp:Label ID="Label1" runat="server" Text="111-查询"></asp:Label>
</div>
<div id="tab2" runat="Server">
<asp:Label ID="Label2" runat="server" Text="222-新建"></asp:Label>
</div>
<div id="tab3" runat="Server">
<asp:Label ID="Label3" runat="server" Text="333-修改"></asp:Label>
</div>
</center>
</form>
</body>
</html>
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace JavascriptTest01
{
public partial class WebForm5 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TabButton1_Click(object sender, EventArgs e)
{
tab1.Style.Add("display", "block");
tab2.Style.Add("display", "none");
tab3.Style.Add("display", "none");
TabButton1.CssClass = "aaa";
TabButton2.CssClass = "bbb";
TabButton3.CssClass = "bbb";
}
protected void TabButton2_Click(object sender, EventArgs e)
{
tab1.Style.Add("display", "none");
tab2.Style.Add("display", "block");
tab3.Style.Add("display", "none");
TabButton1.CssClass = "bbb";
TabButton2.CssClass = "aaa";
TabButton3.CssClass = "bbb";
}
protected void TabButton3_Click(object sender, EventArgs e)
{
tab1.Style.Add("display", "none");
tab2.Style.Add("display", "none");
tab3.Style.Add("display", "block");
TabButton1.CssClass = "bbb";
TabButton2.CssClass = "bbb";
TabButton3.CssClass = "aaa";
}
}
}
分享到:
相关推荐
C# Tab键转Enter键,限制输入数字
MDI C# Tab Windows Form 示例程序。功能:传统MDI方式、标签页模式、菜单合并、工具栏合并。surfsky.cnblogs.com
可以放入多个Tab标签,c#后台自定义配置,可以更换皮肤
非常好的Tab控件源码(C#版本),可以根据需要随意变更修改。
源码已上传至: http://www.jiamaocode.com/Pros/1038.htm
C#窗体TabControl控件美化版源代码
C# winform TabControl 自定义标签颜色 点击突出显示 源码简单易懂
自己写的,稍微有点简单,毕竟我也是新手。
导航tab页,导航tab页,导航tab页,导航tab页导航tab页,导航tab页
If anyone is looking for the latest version of the AC.ExtendedRenderer.ToolKit which is mentioned in other posts, then the following links point to the central source of them. However the website is ...
tab标签切换
C#选项卡文档简单实现办法tabcontrol
选项卡 用于开发选项卡 简单实用的html选项卡
WinFormTabContrl控件TabPageName横向显示.rar,代码结构清楚,本人亲测,功能强大
选项卡式浏览器,功能众多,代码没整理,很乱(初学c#时做的)
竖のtabcontrol C# 控件竖的tabcontrol 自定义控件
c# asp .net tab 实现tab功能 源码 希望可以给大家提供帮助 #### or javascript:void(0); return false: a href="####" 点击滚动条不会动 位置不变
C#自定义tabcontrl控件,可实现透明背景,tabpage实现多种样式,美观,功能强大。
对话框动态调整位置大小\Tab控件间的操作\Webbrowser简单操作(显示网页源码)