MultiView 控件是一组 View 控件的容器。使用它可定义一组 View 控件,其中每个 View 控件都包含子控件。

用 ActiveViewIndex 属性或SetActiveView 方法定义活动视图。如果 ActiveViewIndex 属性为空,则 MultiView 控件不向客户端呈现任何内容。

如果活动视图设置为MultiView 控件中不存在的 View,则会在运行时引发 ArgumentOutOfRangeException。

ActiveViewIndex属性:用于获取或设置当前被激活显示的View控件的索引值。默认值为-1,表示没有View控件被激活。

首先,添加web窗体,在页面前面加上如下代码

  <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">first</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">second</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" runat="server" onclick="LinkButton3_Click">third</asp:LinkButton>
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex ="">
<asp:View ID="View1" runat="server">
this is the first page
</asp:View>
<asp:View ID="View2" runat="server">
this is the second page
</asp:View>
<asp:View ID="View3" runat="server">
this is the third page
</asp:View>
</asp:MultiView>

在页面后面加上如下代码:

 protected void Page_Load(object sender, EventArgs e)
{ }
protected void LinkButton1_Click(object sender, EventArgs e) {
this.MultiView1.ActiveViewIndex = ;
}
protected void LinkButton2_Click(object sender, EventArgs e) {
this.MultiView1.ActiveViewIndex = ;
}
protected void LinkButton3_Click(object sender, EventArgs e) {
this.MultiView1.ActiveViewIndex = ;
}

保存后运行,即可显示像选项卡的效果,这种方法会刷新页面

ASP.NET服务器控件使用之MultiView和View的更多相关文章

  1. 【转】ASP.NET服务器控件使用之MultiView和View

    MultiView 和 View 控件和制作出选项卡的效果,MultiView 控件是一组 View 控件的容器.使用它可定义一组 View 控件,其中每个 View 控件都包含子控件. 如果要切换视 ...

  2. ASP.NET服务器控件对应的HTML标签

    了解ASP.NET的控件最终解析成什么HTML代码,有助于我们对ASP.NET更深的了解,在使用JS交互时也知道如何操作. ASP.NET 服务器控件渲染到客户端之后对应的HTML标签讲解. labe ...

  3. ASP.NET服务器控件Menu

    http://www.cnblogs.com/huc87/archive/2009/04/05/1429831.html ASP.NET服务器控件Menu 1.       ASP.NET 服务器控件 ...

  4. js 操作ASP.NET服务器控件

    js 操作ASP.NET服务器控件 在ASP.NET中使用js时,js获取DOM元素时,经常获取不到,这是因为获取的方法有误,现在介绍一方法,解决如何使用js获取ASP.NET控件在浏览器端生成htm ...

  5. 【转】【Asp.Net】asp.net服务器控件创建

    VS新建一个Web服务控件工程,会默认生成以下代码: namespace WebControlLibrary { [DefaultProperty("Text")] [Toolbo ...

  6. JQuery EasyUI弹出对话框解决Asp.net服务器控件无法执行后台代码的方法(转)

    原文:JQuery EasyUI弹出对话框解决Asp.net服务器控件无法执行后台代码的方法 jquery-easyui是一个基于jquery的图形界面插件,利用easyui可以创建很多好看的网页界面 ...

  7. ASP.NET MVC- VIEW Creating Page Layouts with View Master Pages Part 4

    In this tutorial, you learn how to create a common page layout for multiple pages in your applicatio ...

  8. Asp.net服务器控件在IE10下的不兼容问题

    Asp.net服务器控件在IE10下的不兼容问题 时间:2013-05-16 09:07点击: 89 次 [大 中 小] 相信很多使用IE10的童鞋们已经发现了这个问题,以下是本人在IE10标准模式下 ...

  9. asp.net服务器控件防止多次提交问题

    用户可能点击多次提交按钮.这样,导致向数据库中插入了多条相同的记录. 好像这2个方法都是针对的服务器控件! //方法一:在提交时调用一段客户端的代码. function a() { document. ...

随机推荐

  1. redis的info

    redis的info     http://redis.readthedocs.org/en/latest/server/info.html   INFO   INFO [section]   以一种 ...

  2. android使用微软雅黑字体

    android使用微软雅黑字体,需要下载字体 ttf文件 下载地址:http://download.csdn.net/detail/xiaoliu123586/9049815 放在assert,然后引 ...

  3. The available repos for opensuse13.2

    opensuse13.2国内源和设置命令   ustc-osshttp://mirrors.ustc.edu.cn/opensuse/distribution/13.2/repo/oss/ustc-n ...

  4. Sample: Write And Read data from HDFS with java API

    HDFS: hadoop distributed file system 它抽象了整个集群的存储资源,可以存放大文件. 文件采用分块存储复制的设计.块的默认大小是64M. 流式数据访问,一次写入(现支 ...

  5. [转]Ionic Datepicker

    本文转自:https://market.ionic.io/plugins/ionicdatepicker ##Introduction: This is an ionic-datepicker bow ...

  6. DP+单调队列 codevs 1748 瑰丽华尔兹(还不是很懂具体的代码实现)

    codevs 1748 瑰丽华尔兹 2005年NOI全国竞赛  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 大师 Master 题解       题目描述 Descripti ...

  7. 如此低价的ZBrush,你能想象?

      作为3D艺术的狂热者,你是否曾为找不到一款适合自己的雕刻软件而苦恼?要么,你已经找到了,却因为昂贵的价格而迟迟不肯入手? 作为改变整个三维行业的业界先进的数字雕刻和绘画软件,ZBrush向来拥有广 ...

  8. Windows环境中Openfire与Spark安装与配置指南

    安装软件: openfire3.9.3 spark2.6.3 安装环境: WindowsXP JDK1.6.0_21 Oracle 一.openfire安装 1.安装openfire3.9.3,下载地 ...

  9. 部署Zipkin分布式性能追踪日志系统的操作记录

    Zipkin是Twitter的一个开源项目,是一个致力于收集Twitter所有服务的监控数据的分布式跟踪系统,它提供了收集数据,和查询数据两大接口服务. 部署Zipkin环境的操作记录:部署Zipki ...

  10. 或得的一个div是变量时