`
jinvasshole
  • 浏览: 771306 次
文章分类
社区版块
存档分类
最新评论

asp.net2.0中MultiView应用实例

 
阅读更多

在asp.net1.1中曾经推出了TreeView、MultiPage等插件(因为不是vs2003内置的),需要下载安装相关的插件才能使用,这些当年我也曾用过,不过感觉用起来不是太方便(到服务器上部署时还需要安装一遍),现在到vs2005中这些都成为内置控件了,极大的方便了开发和部署,TreeView控件似乎没有太多要说的,今天我就展示一下MultiPage控件的升级产品MultiView控件。

设计时视图:

以下是运行时的截图:


前台aspx代码如下:

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="MultiViewDemo.aspx.cs"Inherits="MultiViewDemo"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>MultiView应用实例</title>
<styletype="text/css">
body
{
font-size
:11pt;
font-family
:宋体;
}
.mainTitle
{
font-size
:12pt;
font-weight
:bold;
font-family
:宋体;
}
.commonText
{
font-size
:11pt;
font-family
:宋体;
}
.littleMainTitle
{
font-size
:10pt;
font-weight
:bold;
font-family
:宋体;
}
.TopTitle
{
border
:0px;
font-size
:10pt;
font-weight
:bold;
text-decoration
:none;
color
:Black;
display
:inline-block;
width
:100%;
}
.SelectedTopTitle
{
border
:0px;
font-size
:10pt;
text-decoration
:none;
color
:Black;
display
:inline-block;
width
:100%;
background-color
:White;
}
.ContentView
{
border
:0px;
padding
:3px3px3px3px;
background-color
:White;
display
:inline-block;
width
:390px;
}
.SepBorder
{
border-top-width
:0px;
border-left-width
:0px;
font-size
:1px;
border-bottom
:Gray1pxsolid;
border-right-width
:0px;
}
.TopBorder
{
border-right
:Gray1pxsolid;
border-top
:Gray1pxsolid;
background
:#DCDCDC;
border-left
:Gray1pxsolid;
color
:black;
border-bottom
:Gray1pxsolid;
}
.ContentBorder
{
border-right
:Gray1pxsolid;
border-top
:Gray0pxsolid;
border-left
:Gray1pxsolid;
border-bottom
:Gray1pxsolid;
height
:100%;
width
:100%;
}
.SelectedTopBorder
{
border-right
:Gray1pxsolid;
border-top
:Gray1pxsolid;
background
:nonetransparentscrollrepeat0%0%;
border-left
:Gray1pxsolid;
color
:black;
border-bottom
:Gray0pxsolid;
}
</style>
</head>
<body>
<formid="form1"runat="server">
<div>
<fieldsetstyle="width:400px">
<legend>MultiView应用实例</legend>
<tablecellpadding="0"cellspacing="0"width="100%"border="0">
<tr>
<td>
<tablerunat="server"cellpadding="0"cellspacing="0"width="100%"border="0">
<trstyle="height:22px">
<tdclass="SelectedTopBorder"id="Cell1"align="center"style="width:80px;">
<asp:LinkButtonID="lButtonCompany"runat="server"OnClick="lButtonCompany_Click">公司介绍</asp:LinkButton></td>
<tdclass="SepBorder"style="width:2px;height:22px;"></td>
<tdclass="TopBorder"id="Cell2"align="center"style="width:80px;">
<asp:LinkButtonID="lButtonProduct"runat="server"OnClick="lButtonProduct_Click">产品介绍</asp:LinkButton></td>
<tdclass="SepBorder"style="width:2px;height:22px;"></td>
<tdclass="TopBorder"id="Cell3"align="center"style="width:80px;">
<asp:LinkButtonID="lButtonContact"runat="server"OnClick="lButtonContact_Click">联系我们</asp:LinkButton></td>
<tdclass="SepBorder"style="width:2px;height:22px;"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<tableclass="ContentBorder"cellpadding="0"cellspacing="0"width="100%">
<tr>
<tdvalign="top">
<asp:MultiViewID="mvCompany"runat="server"ActiveViewIndex="0">
<asp:ViewID="View1"runat="server">
我们公司是一个正在上升时期的公司。公司目前有中科院计算机院士3人,博士后32人,博士63人,研究生120人,本科生356人,具有非常强大研发实力。
</asp:View>
<asp:ViewID="View2"runat="server">
我们有丰富的产品线,还可以为用户单独定制。目前有吹牛软件、撒谎软件、包二奶软件等等,正在研发的软件有火星定位软件、超时空软件等等。
</asp:View>
<asp:ViewID="View3"runat="server">
我们的联系方式是119,传真是110,是120,售后电话114。
</asp:View>
</asp:MultiView>&nbsp;
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>

</div>
</form>
</body>
</html>
后台cs代码如下:
usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;

publicpartialclassMultiViewDemo:System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{

}
protectedvoidlButtonCompany_Click(objectsender,EventArgse)
{
mvCompany.ActiveViewIndex
=0;
Cell1.Attributes[
"class"]="SelectedTopBorder";
Cell2.Attributes[
"class"]="TopBorder";
Cell3.Attributes[
"class"]="TopBorder";
}
protectedvoidlButtonProduct_Click(objectsender,EventArgse)
{
mvCompany.ActiveViewIndex
=1;
Cell1.Attributes[
"class"]="TopBorder";
Cell2.Attributes[
"class"]="SelectedTopBorder";
Cell3.Attributes[
"class"]="TopBorder";
}
protectedvoidlButtonContact_Click(objectsender,EventArgse)
{
mvCompany.ActiveViewIndex
=2;
Cell1.Attributes[
"class"]="TopBorder";
Cell2.Attributes[
"class"]="TopBorder";
Cell3.Attributes[
"class"]="SelectedTopBorder";
}
}
这里你可以修改页面中的css样式代码,更改成适合自己风格的色彩和样式。
分享到:
评论

相关推荐

    零基础学ASP.NET 2.0电子书&源代码绝对完整版1

    示例描述:本章演示ASP.NET 2.0网站的预编译以及学习ASP.NET 2.0的前置知识。 WebSite文件夹 创建的ASP.NET 2.0 Web站点。 www文件夹 第一个用C#开发的Web应用程序。 bianyi.bat 编译网站的批处理文件。 ...

    2.ASP.NET.2.0.高级编程(第4版) [1/7]

    书中提供了大量的实例,可帮助读者快速掌握如何在.NET平台下开发功能强大的ASP.NET应用程序。本书适合有一些基础的ASP.NET初级程序员以及准备迁移到ASP.NET 2.0的编程老手。该书与《ASP.NET 2.0入门经典(第4版)》...

    ASP.NET2.0高级编程(第4版)1/6

    书中提供了大量的实例,可帮助读者快速掌握如何在.NET平台下开发功能强大的ASP.NET应用程序。本书适合有一些基础的ASP.NET初级程序员以及准备迁移到ASP.NET 2.0的编程老手。该书与《ASP.NET 2.0入门经典(第4版)》...

    零基础学ASP.NET 2.0&源代码绝对完整版1

    示例描述:本章演示ASP.NET 2.0网站的预编译以及学习ASP.NET 2.0的前置知识。 WebSite文件夹 创建的ASP.NET 2.0 Web站点。 www文件夹 第一个用C#开发的Web应用程序。 bianyi.bat 编译网站的批处理文件。 form...

    multiview和wizard控件应用实例

    在asp.net 1.1中,如果要做一个具有向导式的应用程序,是比较麻烦的。所谓向导式应用,就是说比如一个注册用户的应用,是...而在asp.net 2.0中,引入了两个新的控件:Multiview和Wizard向导控件,大大方便了用户的使用。

    ASP.NET3.5从入门到精通

    16.1.3 ASP.NET 2.0 AJAX 16.1.4 ASP.NET 3.5 AJAX 第一篇窗口与界面编程 19 16.1.5 AJAX 简单示例 16.2 ASP.NET 3.5AJAX 控件 16.2.1 脚本管理控件(ScriptManger) 16.2.2 脚本管理控件(ScriptMangerProxy) ...

    ASP.NET 3.5 开发大全

    16.1.3 ASP.NET 2.0 AJAX 16.1.4 ASP.NET 3.5 AJAX 16.1.5 AJAX简单示例 16.2 ASP.NET 3.5AJAX控件 16.2.1 脚本管理控件(ScriptManger) 16.2.2 脚本管理控件(ScriptMangerProxy) 16.2.3 时间控件(Timer) ...

    ASP.NET 3.5 开发大全word课件

    16.1.3 ASP.NET 2.0 AJAX 16.1.4 ASP.NET 3.5 AJAX 16.1.5 AJAX简单示例 16.2 ASP.NET 3.5AJAX控件 16.2.1 脚本管理控件(ScriptManger) 16.2.2 脚本管理控件(ScriptMangerProxy) 16.2.3 时间控件(Timer) ...

    ASP.NET4高级程序设计第4版 带目录PDF 分卷压缩包 part1

    1.2.2 ASP.NET2.0 1.2.3 ASP.NET3.5 1.2.4 ASP.NET4 1.2.5 Silverlight 1.3 总结 第2章 Visual Studio 2.1 Visual Studio 2.1.1 网站和Web项目 2.1.2 创建无项目文件的网站 2.1.3 设计网页 2.2...

    ASP.NET 3.5 开发大全11-15

    16.1.3 ASP.NET 2.0 AJAX 16.1.4 ASP.NET 3.5 AJAX 16.1.5 AJAX简单示例 16.2 ASP.NET 3.5AJAX控件 16.2.1 脚本管理控件(ScriptManger) 16.2.2 脚本管理控件(ScriptMangerProxy) 16.2.3 时间控件(Timer) ...

    ASP.NET 3.5 开发大全1-5

    16.1.3 ASP.NET 2.0 AJAX 16.1.4 ASP.NET 3.5 AJAX 16.1.5 AJAX简单示例 16.2 ASP.NET 3.5AJAX控件 16.2.1 脚本管理控件(ScriptManger) 16.2.2 脚本管理控件(ScriptMangerProxy) 16.2.3 时间控件(Timer) ...

    ASP.NET4高级程序设计(第4版) 3/3

    1.2.2 ASP.NET2.0 9 1.2.3 ASP.NET3.5 10 1.2.4 ASP.NET4 12 1.2.5 Silverlight 14 1.3 总结 15 第2章 Visual Studio 16 2.1 Visual Studio 16 2.1.1 网站和Web项目 17 2.1.2 创建无项目文件的...

    ASPNET35开发大全第一章

    16.1.3 ASP.NET 2.0 AJAX 16.1.4 ASP.NET 3.5 AJAX 16.1.5 AJAX简单示例 16.2 ASP.NET 3.5AJAX控件 16.2.1 脚本管理控件(ScriptManger) 16.2.2 脚本管理控件(ScriptMangerProxy) 16.2.3 时间控件(Timer) ...

    制作第一个页面 欢迎您进入.Net启动运行

    √(vs200521) 25. Asp.Net中的事件(控件事件) √(vs200522) 26. 小结考试√(ceshi04) 类 27. 类的概述√(vs200523) 28. 类的自定义事件√(vs200524) 29. 类--共享成员√(vs200525) 30. ...

    GridView使用技巧一

    √(vs200521) 25. Asp.Net中的事件(控件事件) √(vs200522) 26. 小结考试√(ceshi04) 类 27. 类的概述√(vs200523) 28. 类的自定义事件√(vs200524) 29. 类--共享成员√(vs200525) 30. ...

    GridView使用技巧二

    √(vs200521) 25. Asp.Net中的事件(控件事件) √(vs200522) 26. 小结考试√(ceshi04) 类 27. 类的概述√(vs200523) 28. 类的自定义事件√(vs200524) 29. 类--共享成员√(vs200525) 30. ...

    C#编程经验技巧宝典

    110 &lt;br&gt;5.5 NET应用技巧 110 &lt;br&gt;0180 如何使用ASP.NET技术对口令加密 110 &lt;br&gt;0181 如何设定ASP.NET全局变量 111 &lt;br&gt;0182 如何设定全局联接数据库对象 111 &lt;br&gt;0183 如何在ASP.NET中获得...

Global site tag (gtag.js) - Google Analytics