MultiView.Views プロパティ
アセンブリ: System.Web (system.web.dll 内)

MultiView コントロール内の View コントロールのコレクションを表す ViewCollection。既定値は null 参照 (Visual Basic では Nothing) です。


View コントロールを、プログラムによって MultiView コントロールに追加する方法の例を次に示します。各 View コントロールが作成された後で MultiView.Views.Add() 構文を使用して、View コントロールを MultiView コントロールの ViewCollection コレクションに追加します。
![]() |
---|
次のコード サンプルはシングルファイル コード モデルを使用しており、分離コード ファイルに直接コピーされた場合は正常に動作しない可能性があります。このコード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。Web フォームのコード モデルの詳細については、「ASP.NET Web ページのコード モデル」を参照してください。 |
<%@ Page Language="VB"%> <html> <head> <script runat="server"> Sub Index_Changed(ByVal Sender As Object, ByVal e As EventArgs) ' A MultiView was added to the page declaratively. ' Now add the View control programmatically. If SelectViewListBox.SelectedIndex >= 0 Then ' The user selected a view. ' Determine which view the user selected. Dim viewName As String = SelectViewListBox.SelectedItem.Text Dim myView as New View ' Use a helper function to create the view. myView = CreateView(viewName, "This is " + viewName) ' Add myView to the ViewCollection of the MultiView1 control. MultiView1.Views.Add(myView) ' Set myView as the active view. MultiView1.SetActiveView(myView) ' The Panel control was initially set to not visible. ' Set it to visible to add styles to the myView. Panel1.Visible=True Else Throw New Exception("You did not select a valid view.") End If End Sub ' A function to programmatically create a View control. Private Function CreateView(ByVal viewId As String, ByVal viewDescription As String) As View ' Create a View control Dim myView As New View myView.ID = viewId ' Create a Label control. Dim Label1 As New Label ' Set the text property for the label. Label1.Text = viewDescription ' Add the label to the controls collection of the view. myView.Controls.Add(Label1) Return myView End Function </script> </head> <body> <form ID="Form1" runat="server"> <h3>ViewCollection Class Example</h3> <h4>Select a View to create and display in a MultiView control:</h4> <asp:ListBox ID=SelectViewListBox AutoPostBack="True" Rows="1" SelectionMode="Single" OnSelectedIndexChanged="Index_Changed" runat="Server"> <asp:ListItem Value=0>View1</asp:ListItem> <asp:ListItem Value=1>View2</asp:ListItem> </asp:ListBox><br><br> <hr><br> <asp:Panel ID="Panel1" Height="75px" Width="100px" Backcolor="Aqua" BorderStyle="Double" Visible = "False" runat="Server"> <asp:MultiView ID="MultiView1" runat="Server"> </asp:MultiView> </asp:Panel> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MultiView クラス
MultiView メンバ
System.Web.UI.WebControls 名前空間
ViewCollection
その他の技術情報
MultiView Web サーバー コントロールおよび View Web サーバー コントロール
Weblioに収録されているすべての辞書からMultiView.Views プロパティを検索する場合は、下記のリンクをクリックしてください。

- MultiView.Views プロパティのページへのリンク