View是视图控件,Multiview是多视图控件,二者都属于容器控件,通常一起使用。MultiView 控件类似于 WinForm 中的 TabControl 控件,可以在一个页面中,放置多个 View(即选项卡),这时可以认为MultiView是View的容器。可以使用 MultiView,在同个页面中,通过切换到不同的选项卡,查看不同的内容,而不用打开另外一个页面。
View可以表示跳到哪一页

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MultiViewDemo1.aspx.cs" Inherits="Web925应用程序.MultiViewDemo1" %>

<!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:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
            <asp:View ID="View1" runat="server">
             <asp:Button ID="Button5" runat="server" Text="到某一页"  CommandName="SwitchViewByID" CommandArgument="View3"/>
                <asp:Button ID="Button1" runat="server" Text="下一页"  CommandName="NextView"/><br />
             <asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
            </asp:View>
            <asp:View ID="View2" runat="server">
                          <asp:Button ID="Button3" runat="server" Text="上一页"  CommandName="PrevView"/><br />
             <asp:Button ID="Button2" runat="server" Text="下一页"  CommandName="NextView"/><br />

                <asp:DropDownList ID="DropDownList1" runat="server">
               
                    <asp:ListItem Value="1">山东</asp:ListItem>
                    <asp:ListItem Value="2">湖南</asp:ListItem>
                    <asp:ListItem Value="3">河北</asp:ListItem>
               
                </asp:DropDownList>
            </asp:View>
            <asp:View ID="View3" runat="server">
        <asp:Button ID="Button4" runat="server" Text="上一页"  CommandName="PrevView"/><br />
                <asp:FileUpload ID="FileUpload1" runat="server" />
            </asp:View>
        </asp:MultiView>
      
       
       

  
    </div>
    </form>
</body>
</html>

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐