View.Deactivate イベントとは? わかりやすく解説

View.Deactivate イベント

メモ : このイベントは、.NET Framework version 2.0新しく追加されたものです。

現在のアクティブ View コントロールアクティブなくなったときに発生します

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

解説解説
使用例使用例

View コントロールDeactivate イベントイベント ハンドラ指定およびコード化する方法次のコード例示しますアクティブ ビュー変更されると、Activate イベント発生させた View コントロールと、Deactivate イベント発生させた View コントロール指定するメッセージユーザー表示されます。

<%@ Page Language="VB" %>

<html>
<head>

    <script runat="server">

        Sub Index_Changed(ByVal Sender As
 Object, ByVal e As EventArgs)
            ' Set the active view to
            ' the view selected by the user.
            Dim str As String
 = ViewListBox.SelectedItem.Text
            Select Case (str)
                Case "DefaultView"
                    MultiView1.SetActiveView(DefaultView)
                Case "NewsView"
                    MultiView1.SetActiveView(NewsView)
                Case "ShoppingView"
                    MultiView1.SetActiveView(ShoppingView)
            End Select

        End Sub

        ' The handler for the DefaultView's Activate event.
        Sub DefaultView_Activate(ByVal sender
 As Object, ByVal e As
 EventArgs)
            ' Notify the user that the event was raised.
            ActivateLabel.Text = "The Activate event was raised
 for the DefaultView."
        End Sub

        ' The handler for the DefaultView's Deactivate event.
        Sub DefaultView_Deactivate(ByVal sender
 As Object, ByVal e As
 EventArgs)
            ' Notify the user that the event was raised.
            DeactivateLabel.Text = "The Deactivate event was raised
 for the DefaultView."
        End Sub

        ' The handler for the ShoppingView's Activate event.
        Sub ShoppingView_Activate(ByVal sender
 As Object, ByVal e As
 EventArgs)
            ' Notify the user that the event was raised.
            ActivateLabel.Text = "The Activate event was raised
 for the ShoppingView."
        End Sub

        ' The handler for the ShoppingView's Deactivate event.
        Sub ShoppingView_Deactivate(ByVal sender
 As Object, ByVal e As
 EventArgs)
            ' Notify the user that the event was raised.
            DeactivateLabel.Text = "The Deactivate event was raised
 for the ShoppingView."
        End Sub

        ' The handler for the NewsView's Activate event.
        Sub NewsView_Activate(ByVal sender
 As Object, ByVal e As
 EventArgs)
            ' Notify the user that the event was raised.
            ActivateLabel.Text = "The Activate event was raised
 for the NewsView."
        End Sub

        ' The handler for the NewsView's Deactivate event.
        Sub NewsView_Deactivate(ByVal sender
 As Object, ByVal e As
 EventArgs)
            ' Notify the user that the event was raised.
            DeactivateLabel.Text = "The Deactivate event was raised
 for the NewsView."
        End Sub

    </script>

</html>
<body>
    <form ID="Form1" runat="server">
        
        <h3>View Activate and Deactivate Events Example</h3>
        
        <h4>Select a view to display in
 a MultiView control:</h4>

        <asp:ListBox id="ViewListBox" 
        Rows="1"
        SelectionMode="Single"
        AutoPostBack="True"
        OnselectedIndexChanged="Index_Changed"
        runat="Server">             
           <asp:ListItem Value=0>DefaultView</asp:ListItem>
           <asp:ListItem Value=1>NewsView</asp:ListItem>
           <asp:ListItem Value=2>ShoppingView</asp:ListItem>
    </asp:ListBox><br><br>
           
    <hr>                 

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

            <asp:View id="DefaultView" 
                OnActivate="DefaultView_Activate"
                OnDeactivate="DefaultView_Deactivate"
                 
                runat="Server">                

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

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

            </asp:View>

            <asp:View id="NewsView" 
                OnActivate="NewsView_Activate"
                OnDeactivate="NewsView_Deactivate"
                runat="Server">

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

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

            </asp:View>

            <asp:View id="ShoppingView" 
                OnActivate="ShoppingView_Activate"
                OnDeactivate="ShoppingView_Deactivate"
                runat="Server">

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

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

            </asp:View>

        </asp:MultiView><br><br>        

        <asp:Label ID="ActivateLabel"
            BackColor="#ffff66"
            runat="Server">
        </asp:Label><br>

        <asp:Label ID="DeactivateLabel"
            BackColor="#ffff66"
            runat="Server">
        </asp:Label>

    </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からView.Deactivate イベントを検索した結果を表示しています。
Weblioに収録されているすべての辞書からView.Deactivate イベントを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からView.Deactivate イベントを検索

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

辞書ショートカット

すべての辞書の索引

View.Deactivate イベントのお隣キーワード
検索ランキング

   

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



View.Deactivate イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS