MultiView.GetActiveView メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MultiView.GetActiveView メソッドの意味・解説 

MultiView.GetActiveView メソッド

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

MultiView コントロール内の現在のアクティブView コントロール返します

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

Dim instance As MultiView
Dim returnValue As View

returnValue = instance.GetActiveView
public View GetActiveView ()
public:
View^ GetActiveView ()
public View GetActiveView ()
public function GetActiveView () : View

戻り値
MultiView コントロール内のアクティブ ビューを表す View コントロール

例外例外
解説解説

MultiView コントロール内で現在アクティブ ビュー設定されている View コントロール返すには、このメソッド使用します。このメソッドView コントロール返すため、アクティブ ビュープロパティアクセスするために使用できます。たとえば、MultiView1.GetActiveView.ID は MultiView1 内の現在のアクティブ ビューID プロパティの値を返します

または、ActiveViewIndex プロパティ使用してMultiView コントロール内の現在のアクティブ ビューの 0 から始まるインデックス取得または設定できます。このプロパティは、宣言によってアクセスすることも、プログラムによってアクセスすることもできます

使用例使用例

3 つの View コントロール格納している MultiView コントロール作成する方法の例を次に示します。ActiveViewChanged イベント発生すると、GetActiveView メソッド使用して現在のアクティブ ビュー返されページLabel コントロール表示されます。

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要がありますWeb フォームコード モデル詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page Language="VB" %>

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

        Sub MultiView1_ActiveViewChanged(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
            Dim activeView As String
            activeView = MultiView1.GetActiveView.ID
            ActiveViewLabel.Text = "The ActiveViewChanged event
 was raised." + _
                                   "<br>" +
 "The active view is set to " + activeView
                                   
        End Sub

        Sub LinkButton_Command(ByVal sender
 As Object, ByVal 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)
            End Select

        End Sub

</script>

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

         <asp:MultiView id="MultiView1"
            ActiveViewIndex=0
            OnActiveViewChanged="MultiView1_ActiveViewChanged"
            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>
        
        <hr>
        
        <asp:Label id="ActiveViewLabel"       
      
            BorderStyle=None
            Font-Size=Small
            BackColor="#ffff66"
            runat="Server" > 
        </asp:Label>     

    </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MultiView クラス
MultiView メンバ
System.Web.UI.WebControls 名前空間
View
SetActiveView
ActiveViewIndex
その他の技術情報
MultiView Web サーバー コントロールおよび View Web サーバー コントロール



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

辞書ショートカット

すべての辞書の索引

MultiView.GetActiveView メソッドのお隣キーワード
検索ランキング

   

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



MultiView.GetActiveView メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS