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

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Calendar.VisibleMonthChanged イベントの意味・解説 

Calendar.VisibleMonthChanged イベント

ユーザータイトル見出し前後の月へのナビゲーション コントロールクリックしたときに発生します

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

Public Event VisibleMonthChanged As
 MonthChangedEventHandler
Dim instance As Calendar
Dim handler As MonthChangedEventHandler

AddHandler instance.VisibleMonthChanged, handler
public event MonthChangedEventHandler VisibleMonthChanged
public:
event MonthChangedEventHandler^ VisibleMonthChanged {
    void add (MonthChangedEventHandler^ value);
    void remove (MonthChangedEventHandler^ value);
}
/** @event */
public void add_VisibleMonthChanged (MonthChangedEventHandler
 value)

/** @event */
public void remove_VisibleMonthChanged (MonthChangedEventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

VisibleMonthChanged イベントハンドラ指定およびコード化して、Calendar コントロール1 つ前の月に移動したのか、1 つ後の月移動したのかを表示する方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>

<html>

<head>

   <script runat="server">

      Sub MonthChange(sender As Object,
 e As MonthChangedEventArgs) 

         If e.NewDate.Month > e.PreviousDate.Month Then
         
            Message.Text = "You moved forward one month."
         
         Else
         
            Message.Text = "You moved backwards one month."
       
         End If

      End Sub
         
   </script>
 
</head>
 
<body>
 
   <form runat="server">

      <h3> Calendar VisibleMonthChanged Example </h3>
       
      Select a different month on the calendar.
 
      <br><br>
 
      <asp:Calendar id="Calendar1" runat="server"
           OnVisibleMonthChanged="MonthChange">

         <WeekendDayStyle BackColor="gray">
         </WeekendDayStyle>

      </asp:Calendar>

      <hr> 

      <table border="1">

         <tr bgcolor="Silver">

            <th>

               Month navigation direction

            </th>
         </tr>

         <tr>

            <td>
           
               <asp:Label id="Message" 
                    Text="Starting Month." 
                    runat="server"/>

            </td>

         </tr>

      </table>
                   
   </form>
         
</body>

</html>
   
<%@ Page Language="C#" AutoEventWireup="True" %>

<html>

<head>

   <script runat="server">

      void MonthChange(Object sender, MonthChangedEventArgs e)
 
      {

         if (e.NewDate.Month > e.PreviousDate.Month)
         { 
            Message.Text = "You moved forward one month.";
         }
         else
         {
            Message.Text = "You moved backwards one month.";
         }

      }
         
   </script>
 
</head>
 
<body>
 
   <form runat="server">

      <h3> Calendar VisibleMonthChanged Example </h3>
       
      Select a different month on the calendar. 
      <br><br>
 
      <asp:Calendar id="Calendar1" runat="server"
           OnVisibleMonthChanged="MonthChange">

         <WeekendDayStyle BackColor="gray">
         </WeekendDayStyle>

      </asp:Calendar>

      <hr> 

      <table border="1">

         <tr bgcolor="Silver">

            <th>

               Month navigation direction

            </th>
         </tr>

         <tr>

            <td>
           
               <asp:Label id="Message" 
                    Text="Starting month." 
                    runat="server"/>

            </td>

         </tr>

      </table>
                   
   </form>
         
</body>

</html>
   
<%@ Page Language="VB" AutoEventWireup="True"
 %>

<html>

<head>

   <script runat="server">

      Sub MonthChange(sender As Object,
 e As MonthChangedEventArgs) 

         If e.NewDate.Month > e.PreviousDate.Month Then
         
            Message.Text = "You moved forward one month."
         
         Else
         
            Message.Text = "You moved backwards one month."
       
         End If

      End Sub

      Sub Page_Load(sender As Object,
 e As EventArgs)

         ' Manually register the event-handling method for the 
         ' VisibleMonthChanged event of the Calendar control.
         AddHandler Calendar1.VisibleMonthChanged, AddressOf
 MonthChange

      End Sub
         
   </script>
 
</head>
 
<body>
 
   <form runat="server">

      <h3> Calendar VisibleMonthChanged Example </h3>
       
      Select a different month on the calendar.
 
      <br><br>
 
      <asp:Calendar id="Calendar1" runat="server">

         <WeekendDayStyle BackColor="gray">
         </WeekendDayStyle>

      </asp:Calendar>

      <hr> 

      <table border="1">

         <tr bgcolor="Silver">

            <th>

               Month navigation direction

            </th>
         </tr>

         <tr>

            <td>
           
               <asp:Label id="Message" 
                    Text="Starting Month." 
                    runat="server"/>

            </td>

         </tr>

      </table>
                   
   </form>
         
</body>

</html>
   
<%@ Page Language="C#" AutoEventWireup="True" %>

<html>

<head>

   <script runat="server">

      void MonthChange(Object sender, MonthChangedEventArgs e)
 
      {

         if (e.NewDate.Month > e.PreviousDate.Month)
         { 
            Message.Text = "You moved forward one month.";
         }
         else
         {
            Message.Text = "You moved backwards one month.";
         }

      }

      void Page_Load(Object sender, EventArgs e)
      {

         // Manually register the event-handling method for the  
         // VisibleMonthChanged event of the Calendar control.
         Calendar1.VisibleMonthChanged += 
            new MonthChangedEventHandler(this.MonthChange);

      }
         
   </script>
 
</head>
 
<body>
 
   <form runat="server">

      <h3> Calendar VisibleMonthChanged Example </h3>
       
      Select a different month on the calendar. 
      <br><br>
 
      <asp:Calendar id="Calendar1" runat="server">

         <WeekendDayStyle BackColor="gray">
         </WeekendDayStyle>

      </asp:Calendar>

      <hr> 

      <table border="1">

         <tr bgcolor="Silver">

            <th>

               Month navigation direction

            </th>
         </tr>

         <tr>

            <td>
           
               <asp:Label id="Message" 
                    Text="Starting month." 
                    runat="server"/>

            </td>

         </tr>

      </table>
                   
   </form>
         
</body>

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



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

辞書ショートカット

すべての辞書の索引

「Calendar.VisibleMonthChanged イベント」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS