试着在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>
<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>
解决方案 »
- 每天每个ip限投票2次中午12点为中心线,上下午各一次access查询语句怎么写
- ajax遇到的问题
- 请问EF框架在asp.net实际应用开发中 用的多不多?需要掌握哪些基本技术?
- [2008/06/30]code
- 建dataset数据集时出现了无法建子段的错误!~!!代码如下那个大哥帮帮小弟
- 注册账号后在别的网站进行提交信息进行登录
- dropdownlist并不包含对"selectedvalue"的定义是什么意思?
- “未将对象引用设置到对象的实例。”的错误,上面原因,附代码。
- 急救!
- VS7好象无法对自己写的类CodeInSight?
- 如何实现一个测试系统
- sp.net中 怎么保存变量的值,选择不同的值点击保存按钮后,数据没有变化
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: 无法选择被禁用或不可选择的菜单项。
望高手指点