Calendar.OnSelectionChangedとは? わかりやすく解説

Calendar.OnSelectionChanged メソッド

SelectionChanged イベント発生させます

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

Protected Overridable Sub
 OnSelectionChanged
Me.OnSelectionChanged
protected virtual void OnSelectionChanged ()
protected:
virtual void OnSelectionChanged ()
protected void OnSelectionChanged ()
protected function OnSelectionChanged ()
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Calendar.OnSelectionChanged メソッド

Calendar コントロールの SelectionChanged イベント発生させて SelectionChanged イベントカスタム ハンドラ指定できるようにします。

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

Protected Overridable Sub
 OnSelectionChanged
Me.OnSelectionChanged
protected virtual void OnSelectionChanged ()
protected:
virtual void OnSelectionChanged ()
protected void OnSelectionChanged ()
protected function OnSelectionChanged ()
解説解説
使用例使用例

SelectionChanged イベントハンドラ指定およびコード化して、Calendar コントロール選択した項目の数を表示する方法次のコード例示します

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

<html>
<head>

   <script runat="server">

      Sub Selection_Change(sender As Object,
 e As EventArgs) 
 
         ' Clear the current text.
         Message.Text = ""

         ' Iterate through the SelectedDates collection and display
 the
         ' dates selected in the Calendar control.
         Dim day As DateTime

         For Each day In
 Calendar1.SelectedDates

            Message.Text &= day.Date.ToShortDateString() & "<br>"

         Next
         
      End Sub

   </script>

</head>     
<body>

   <form runat="server">

      <h3>Calendar SelectionChanged Example</h3>

      Select dates on the Calendar control.<br><br>

      <asp:Calendar ID="Calendar1" runat="server"
  
           SelectionMode="DayWeekMonth" 
           ShowGridLines="True"             
           OnSelectionChanged="Selection_Change">

         <SelectedDayStyle BackColor="Yellow"
                           ForeColor="Red">
         </SelectedDayStyle>

      </asp:Calendar>

      <hr>

      <table border="1">

         <tr bgcolor="Silver">

            <th>

               Selected Dates:

            </th>
         </tr>

         <tr>

            <td>
           
               <asp:Label id="Message" 
                    Text="No dates selected." 
                    runat="server"/>

            </td>

         </tr>

      </table>

   </form>

</body>

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

<html>
<head>

   <script runat="server">

      void Selection_Change(Object sender, EventArgs e) 
      {
 
         // Clear the current text.
         Message.Text = "";

         // Iterate through the SelectedDates collection and display
 the
         // dates selected in the Calendar control.
         foreach(DateTime day in Calendar1.SelectedDates)
         {

            Message.Text += day.Date.ToShortDateString() + "<br>";

         }
         
      }

   </script>

</head>     
<body>

   <form runat="server">

      <h3>Calendar SelectionChanged Example</h3>

      Select dates on the Calendar control.<br><br>

      <asp:Calendar ID="Calendar1" runat="server"  
           SelectionMode="DayWeekMonth" 
           ShowGridLines="True"             
           OnSelectionChanged="Selection_Change">

         <SelectedDayStyle BackColor="Yellow"
                           ForeColor="Red">
         </SelectedDayStyle>

      </asp:Calendar>

      <hr>

      <table border="1">

         <tr bgcolor="Silver">

            <th>

               Selected Dates:

            </th>
         </tr>

         <tr>

            <td>
           
               <asp:Label id="Message" 
                    Text="No dates selected." 
                    runat="server"/>

            </td>

         </tr>

      </table>

   </form>

</body>

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

<html>
<head>

   <script runat="server">

      Sub Selection_Change(sender As Object,
 e As EventArgs) 
 
         ' Clear the current text.
         Message.Text = ""

         ' Iterate through the SelectedDates collection and display
 the
         ' dates selected in the Calendar control.
         Dim day As DateTime

         For Each day In
 Calendar1.SelectedDates

            Message.Text &= day.Date.ToShortDateString() & "<br>"

         Next
         
      End Sub

      Sub Page_Load(sender As Object,
 e As EventArgs)

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

      End Sub

   </script>

</head>     
<body>

   <form runat="server">

      <h3>Calendar SelectionChanged Example</h3>

      Select a day, week, or month on
 the Calendar control.<br><br>

      <asp:Calendar ID="Calendar1" runat="server"
  
           SelectionMode="DayWeekMonth" 
           ShowGridLines="True">

         <SelectedDayStyle BackColor="Yellow"
                           ForeColor="Red">
         </SelectedDayStyle>

      </asp:Calendar>

      <hr>

      <table border="1">

         <tr bgcolor="Silver">

            <th>

               Selected Dates:

            </th>
         </tr>

         <tr>

            <td>
           
               <asp:Label id="Message" 
                    Text="No dates selected." 
                    runat="server"/>

            </td>

         </tr>

      </table>

   </form>

</body>

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

<html>
<head>

   <script runat="server">

      void Selection_Change(Object sender, EventArgs e) 
      {
 
         // Clear the current text.
         Message.Text = "";

         // Iterate through the SelectedDates collection and display
 the
         // dates selected in the Calendar control.
         foreach(DateTime day in Calendar1.SelectedDates)
         {

            Message.Text += day.Date.ToShortDateString() + "<br>";

         }
         
      }

      void Page_Load(Object sender, EventArgs e)
      {

         // Manually register the event-handling method for the  
         // SelectionChanged event of the Calendar control.
         Calendar1.SelectionChanged += new EventHandler(this.Selection_Change);

      }


   </script>

</head>     
<body>

   <form runat="server">

      <h3>Calendar SelectionChanged Example</h3>

      Select a day, week, or month on the Calendar control.<br><br>

      <asp:Calendar ID="Calendar1" runat="server"  
           SelectionMode="DayWeekMonth" 
           ShowGridLines="True">

         <SelectedDayStyle BackColor="Yellow"
                           ForeColor="Red">
         </SelectedDayStyle>

      </asp:Calendar>

      <hr>

      <table border="1">

         <tr bgcolor="Silver">

            <th>

               Selected dates

            </th>
         </tr>

         <tr>

            <td>
           
               <asp:Label id="Message" 
                    Text="No dates selected." 
                    runat="server"/>

            </td>

         </tr>

      </table>

   </form>

</body>

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


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

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

辞書ショートカット

すべての辞書の索引

「Calendar.OnSelectionChanged」の関連用語

Calendar.OnSelectionChangedのお隣キーワード
検索ランキング

   

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



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

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

©2024 GRAS Group, Inc.RSS