VS.NET(C#)-4.3_MultiView和View控件应用案例一
2018-02-23 20:46
603 查看
MultiView和View控件应用案例一MultiView和View搭配实现选项卡效果,切换Tab按钮是用两个Button(ImageButton实现效果更好)。关联到一个事件处理程序。
重点用法:ActiveViewIndex的值来选择当前要显示的view。
UI设计视图
UI代码视图
<%@ PageLanguage="C#"AutoEventWireup="true"CodeFile="MultiViewDemo01.aspx.cs"
Inherits="MultiViewDemo01" %>
<!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:Button ID="btn1" runat="server" Text="请假规则" OnClick="btn1_Click"/>
<asp:Button ID="btn2" runat="server" Text="签核流程" OnClick="btn2_Click"/>
<br />
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<asp:Label ID="lbl01" runat="server" Text="Label"></asp:Label>
</asp:View>
<asp:View ID="View2" runat="server">
<asp:Label ID="lbl02" runat="server" Text="Label"></asp:Label>
</asp:View>
</asp:MultiView>
</div>
</form>
</body>
</html>
CS后台视图
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
public partial class MultiViewDemo01 : System.Web.UI.Page
{
protected void Page_Load(objectsender, EventArgs e)
{
lbl01.Text = "请假说明:首先顶格写称谓,即向谁请假,注意应加上其职务,";
lbl02.Text = "签核流程:按照组织架构原则从课级开始向上签核";
}
protected void btn1_Click(objectsender, EventArgs e)
{
btn_Info(sender, e);
//MultiView1.ActiveViewIndex= 0;
}
protected void btn2_Click(objectsender, EventArgs e)
{
btn_Info(sender, e);
//MultiView1.ActiveViewIndex= 1;
}
protected void btn_Info(objectsender, EventArgs e)
{
Buttonb = (Button)sender;
if(b.ID== "btn1")
{
MultiView1.SetActiveView(View1);
}
else
{
MultiView1.SetActiveView(View2);
}
}
}
UI运行时图
重点用法:ActiveViewIndex的值来选择当前要显示的view。
UI设计视图
UI代码视图
<%@ PageLanguage="C#"AutoEventWireup="true"CodeFile="MultiViewDemo01.aspx.cs"
Inherits="MultiViewDemo01" %>
<!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:Button ID="btn1" runat="server" Text="请假规则" OnClick="btn1_Click"/>
<asp:Button ID="btn2" runat="server" Text="签核流程" OnClick="btn2_Click"/>
<br />
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<asp:Label ID="lbl01" runat="server" Text="Label"></asp:Label>
</asp:View>
<asp:View ID="View2" runat="server">
<asp:Label ID="lbl02" runat="server" Text="Label"></asp:Label>
</asp:View>
</asp:MultiView>
</div>
</form>
</body>
</html>
CS后台视图
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
public partial class MultiViewDemo01 : System.Web.UI.Page
{
protected void Page_Load(objectsender, EventArgs e)
{
lbl01.Text = "请假说明:首先顶格写称谓,即向谁请假,注意应加上其职务,";
lbl02.Text = "签核流程:按照组织架构原则从课级开始向上签核";
}
protected void btn1_Click(objectsender, EventArgs e)
{
btn_Info(sender, e);
//MultiView1.ActiveViewIndex= 0;
}
protected void btn2_Click(objectsender, EventArgs e)
{
btn_Info(sender, e);
//MultiView1.ActiveViewIndex= 1;
}
protected void btn_Info(objectsender, EventArgs e)
{
Buttonb = (Button)sender;
if(b.ID== "btn1")
{
MultiView1.SetActiveView(View1);
}
else
{
MultiView1.SetActiveView(View2);
}
}
}
UI运行时图
相关文章推荐
- VS.NET(C#)-4.4_MultiView和View控件应用案例二
- VS.NET(C#)-4.8_Calendar控件应用案例一
- VS.NET(C#)-4.9_Calendar控件应用案例二
- VS.NET(C#)-4.2_MultiView和View控件
- VS.NET(C#)-4.11_FileUpload控件应用案例一
- VS.NET(C#)-4.6_Wizard控件应用案例
- VS.NET(C#)-3.8_CheckBox应用案例
- VS.NET(C#)-3.10_CheckBoxList应用案例
- VS.NET(C#)-3.11_ListBox应用案例
- VS.NET(C#)-3.6_HyperLink控件
- 利用ArcGIS Engine、VS .NET和Windows控件开发GIS应用
- VS.NET(C#)-3.7_选择值控件
- VisualStudio移动开发(C#、VB.NET)Smobiler开发平台——SliderView控件的使用方式
- ASP.NET中MultiView和View选项卡控件的使用方法
- UI基础-基础控件-0324-浏览图片案例与改进版(UILabel、UIButton、UIImageView的应用)
- asp.net multiview控件如何自动添加view
- VB.net对于datagride控件的使用及C#中datagrideView\bindingSource\bindingNavigator\tabcontrol控件的应用
- VS移动开发(C#、VB.NET)Smobiler开发平台——SliderView控件的使用方式 4000
- VS.NET(C#)-3.9_列表中选择的控件
- ASP.NET - MultiView 和 View Web 服务器控件概述(一)