View クラスとは? わかりやすく解説

View クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

MultiView コントロール内のコントロールグループ用のコンテナとして機能するコントロール表します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説

View コントロールは、コントロールグループ用のコンテナです。View コントロールは、常に MultiView コントロール格納されている必要があります一度1 つView コントロールだけを MultiView コントロール内のアクティブ ビューとして定義できます

ActiveViewIndex プロパティは、MultiView コントロールViews コレクション内のアクティブ View コントロール指定しますアクティブ ビュー コントロールは、そのコントロール格納している MultiView コントロール表示されていればクライアント表示されます。View コントロールその子コントロールページ表示されクライアント表示されているかどうか確認するには、Visible プロパティ使用します

View コントロールには、他の MultiView含め、どの型のコントロールでも格納できますView コントロールは、スタイル プロパティサポートしていません。View コントロールスタイル適用するには、1 つ上の Panel コントロールView コントロール追加します

View クラスには、Activate イベントDeactivate イベント用意されています。Activate イベントは、View コントロールアクティブ ビューになったときに発生します。このイベントは、ActiveViewIndex プロパティの値が変更されるか、SetActiveView メソッド呼び出されて、別の View コントロール指定されたときに発生します。たとえば、View1MultiView コントロール内のアクティブ ビューである場合に、ActiveViewIndex プロパティ変更されView2指定されると、View2 に対して Activate イベント発生しView1 に対して Deactivate イベント発生します

MultiView コントロール内の複数View コントロール間をユーザー移動できるようにするには、LinkButton コントロールまたは Button コントロールを各 View コントロール追加しますLinkButton コントロールまたは Button コントロールCommandName プロパティを、移動先の View コントロールID設定しますコード例については、「ActiveViewChanged」を参照してください

MultiView コントロール内の View コントロール操作する方法詳細については、MultiViewトピック参照してください

使用例使用例

3 つの View コントロール格納している MultiView コントロール作成する方法コード例次に示しますページ初め読み込まれたときに、DefaultViewアクティブ ビューとして設定されます。View コントロールには、ユーザー別のビュー移動できるようにするためのリンク ボタン格納されています。View コントロールには、スタイル適用できるようにするための Panel コントロール格納されています。

<%@ Page Language="VB" %>

<html>
<head>
    <script runat="server">

        Sub Page_Load(ByVal sender As
 Object, ByVal e As System.EventArgs)
            ' The first time the page loads,
            ' render the DefaultView.
            If Not IsPostBack Then
                ' Set DefaultView as the active view.
                MultiView1.SetActiveView(DefaultView)
            End If

        End Sub

        Sub LinkButton_Command(sender As Object,
 e As System.Web.UI.WebControls.CommandEventArgs)
            ' Determine which link button was clicked
            ' and set the active view to
            ' the view selected by the user.
            Select Case (e.CommandArgument)
                Case "DefaultView"
                    MultiView1.SetActiveView(DefaultView)
                Case "News"
                    MultiView1.SetActiveView(NewsView)
                Case "Shopping"
                    MultiView1.SetActiveView(ShoppingView)
                Case Else
                    Throw New Exception("You
 did not select a valid list item.")

            End Select

        End Sub

</script>

</html>
<body>
    <form ID="Form1" runat="server">
        
        <h3>MultiView Class Example</h3>

        <asp:MultiView id="MultiView1"
            runat="Server">

            <asp:View id="DefaultView" 
                runat="Server">                

                <asp:Panel id="DefaultViewPanel"
 
                    Width="330px" 
                    BackColor="#C0C0FF" 
                    BorderColor="#404040"
                    BorderStyle="Double"
                    runat="Server">  

                    <asp:Label id="DefaultLabel1"
 
                        Font-bold="true"
                        Font-size="14" 
                        Text="The Default View"
                        runat="Server">
                    </asp:Label>                  

                    <asp:BulletedList id="DefaultBulletedList1"
 
                        BulletStyle="Disc" 
                        DisplayMode="Hyperlink"
                        Target="_blank"
                        runat="Server">
                            <asp:ListItem Value="http://www.microsoft.com">Today's
 Weather</asp:ListItem>
                            <asp:ListItem Value="http://www.microsoft.com">Today's
 Stock Quotes</asp:ListItem>
                            <asp:ListItem Value="http://www.microsoft.com">Today's
 News Headlines</asp:ListItem>
                            <asp:ListItem Value="http://www.microsoft.com">Today's
 Featured Shopping</asp:ListItem>
                    </asp:BulletedList>

                    <hr>

                    <asp:Label id="DefaultLabel2"
                      
                        Font-size="12" 
                        Text="Click a link to display a different
 view:"
                        runat="Server">
                    </asp:Label><br>
                
                    <asp:LinkButton id="Default_NewsLink"
 
                        Text="Go to News View" 
                        OnCommand="LinkButton_Command"
                        CommandArgument="News" 
                        CommandName="Link"
            Width="150px"
                        runat="Server">
                    </asp:LinkButton>

                    <asp:LinkButton id="Default_ShoppingLink"
                        Text="Go to Shopping View"
 
                        OnCommand="LinkButton_Command"
                        CommandArgument="Shopping"
 
                        CommandName="Link"
            Width="150px"
                        runat="server">
                    </asp:LinkButton><br><br>

                </asp:Panel>

            </asp:View>

            <asp:View id="NewsView" 
                runat="Server">

                <asp:Panel id="NewsPanel1" 
                    Width="330px" 
                    BackColor="#C0FFC0" 
                    BorderColor="#404040"
                    BorderStyle="Double"
                    runat="Server">

                    <asp:Label id="NewsLabel1"
 
                        Font-bold="true"
                        Font-size="14"
                        Text="The News View"
                        runat="Server">                    
                    </asp:Label>

                    <asp:BulletedList id="NewsBulletedlist1"
 
                        BulletStyle="Disc" 
                        DisplayMode="Hyperlink"
                        Target="_blank"
                        runat="Server">
                            <asp:ListItem Value="http://www.microsoft.com">Today's
 International Headlines</asp:ListItem>
                            <asp:ListItem Value="http://www.microsoft.com">Today's
 National Headlines</asp:ListItem>
                            <asp:ListItem Value="http://www.microsoft.com">Today's
 Local News</asp:ListItem>
                    </asp:BulletedList>

                    <hr>

                    <asp:Label id="NewsLabel2"
                      
                        Font-size="12" 
                        Text="Click a link to display a different
 view:"
                        runat="Server">
                    </asp:Label><br>

                    <asp:LinkButton id="News_DefaultLink"
 
                        Text="Go to the Default View"
 
                        OnCommand="LinkButton_Command"
                        CommandArgument="DefaultView"
 
                        CommandName="Link"
                        Width="150px"
                        runat="Server">
                    </asp:LinkButton>

                    <asp:LinkButton id="News_ShoppingLink"
 
                        Text="Go to Shopping View"
 
                        OnCommand="LinkButton_Command"
                        CommandArgument="Shopping"
 
                        CommandName="Link"
                        Width="150px"
                        runat="Server">
                    </asp:LinkButton><br><br>

                </asp:Panel>

            </asp:View>

            <asp:View id="ShoppingView" 
                runat="Server">

                <asp:Panel id="ShoppingPanel1"
 
                    Width="330px" 
                    BackColor="#FFFFC0" 
                    BorderColor="#404040"
                    BorderStyle="Double"
                    runat="Server">

                    <asp:Label id="ShoppingLabel1"
 
                        Font-Bold="true"
                        Font-size="14"                         
                        Text="The Shopping View"
                        runat="Server">
                    </asp:Label>

                    <asp:BulletedList id="ShoppingBulletedlist1"
 
                        BulletStyle="Disc" 
                        DisplayMode="Hyperlink"
                        Target="_blank"
                        runat="Server">
                            <asp:ListItem Value="http://www.microsoft.com">Shop
 for Home and Garden </asp:ListItem>
                            <asp:ListItem Value="http://www.microsoft.com">Shop
 for Women's Fashions</asp:ListItem>
                            <asp:ListItem Value="http://www.microsoft.com">Shop
 for Men's Fashions</asp:ListItem>
                    </asp:BulletedList>

                    <hr>

                    <asp:Label id="ShoppingLabel2"
 
                        Font-size="12" 
                        Text="Click a link to display a different
 view:"
                        runat="Server">
                    </asp:Label><br>

                    <asp:LinkButton id="Shopping_DefaultLink"
 
                        Text="Go to the Default View"
 
                        OnCommand="LinkButton_Command"
                        CommandArgument="DefaultView"
 
                        CommandName="Link"
                        Width="150px"
                        runat="Server">
                    </asp:LinkButton>

                    <asp:LinkButton id="Shopping_NewsLink"
                        Text="Go to News View" 
                        OnCommand="LinkButton_Command"
                        CommandArgument="News" 
                        CommandName="Link"
                        Width="150px"
                        runat="Server">
                    </asp:LinkButton><br><br>

                </asp:Panel>

            </asp:View>

        </asp:MultiView>

    </form>
</body>
</html>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
    System.Web.UI.WebControls.View
       System.Web.UI.WebControls.WizardStepBase
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「View クラス」の関連用語

View クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



View クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS