| 燕君 的个人资料White And Blue照片日志列表 | 帮助 |
|
1月6日 multiview控件 multiview控件,实际上是有点象在c/s开发中很常见的tabcontrol控件,可以在一个页面中,放置多个"view"(我们称为选项卡),比如可以用multiview控件,可以让用户在同一页面中,通过切换到每个选项卡,从而看到要看的内容,而不用每次都重新打开一个新的窗口。 然而对Panel 的 Visible属性进行控制也可以完成这个工作,只是说用这个更专业吧! 未选择某个 View 控件时,该控件不会呈现到页面中。但是,每次呈现页面时都会创建所有 View 控件中的所有 Web 服务器控件的实例,并且将这些实例的值存储为页面的视图状态的一部分。 通过将 MultiView 控件的 ActiveViewIndex 属性设置为要显示的 View 控件的索引值,可以在视图间移动。MultiView 控件还支持可以添加到每个 View 控件的导航按钮。 若要创建导航按钮,可以向每个 View 控件添加一个按钮控件(Button、LinkButton或 ImageButton )。然后可以将每个按钮的 CommandName 和 CommandArgument 属性设置为保留值以使 MultiView 控件移动到另一个视图。下表列出了保留的 CommandName 值和相应的 CommandArgument 值。
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MultiView.aspx.vb" Inherits="MultiView" %>![]() <!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:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"> <asp:ListItem Value="0">view1</asp:ListItem> <asp:ListItem Value="1">view2</asp:ListItem> <asp:ListItem Value="2">view3</asp:ListItem> </asp:DropDownList> <br> <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"> <asp:View ID="View1" runat="server"> 111111111111111111111111111<br /> <asp:Button ID="Button1" runat="server" CommandName="NextView" Text="next" /> <asp:Button ID="Button5" runat="server" CommandArgument="View3" CommandName="SwitchViewByID" Text="last" /></asp:View> <asp:View ID="View2" runat="server"> 222222222222222222222222222<br /> <asp:Button ID="Button2" runat="server" CommandName="PrevView" Text="pre" /> <asp:Button ID="Button3" runat="server" CommandName="NextView" Text="next" /></asp:View> <asp:View ID="View3" runat="server"> 333333333333333333333333333<br /> <asp:Button ID="Button4" runat="server" CommandArgument="0" CommandName="SwitchViewByIndex" Text="first" /> <asp:Button ID="Button6" runat="server" CommandName="preview" Text="pre" /></asp:View> </asp:MultiView></div> </form> </body> </html>![]() Partial Class MultiView Inherits System.Web.UI.Page![]() Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Request.QueryString("id") <> "" Then MultiView1.ActiveViewIndex = Convert.ToInt32(Request.QueryString("id")) End If End Sub![]() Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged MultiView1.ActiveViewIndex = Convert.ToInt32(DropDownList1.SelectedValue) End Sub End Class引用通告此日志的引用通告 URL 是: http://whiteandblue.spaces.live.com/blog/cns!EF8DBCBF3068FC3!196.trak 引用此项的网络日志
|
|
|