Calendar.TodaysDate プロパティ
アセンブリ: System.Web (system.web.dll 内)
構文
Dim instance As Calendar Dim value As DateTime value = instance.TodaysDate instance.TodaysDate = value
/** @property */ public DateTime get_TodaysDate () /** @property */ public void set_TodaysDate (DateTime value)
Calendar が今日の日付と見なしている値を格納している System.DateTime。このプロパティが明示的に設定されていない場合は、サーバーの日付が使用されます。
TodaysDate プロパティを使用して、今日の日付を確認します。また、このプロパティを使用して、Calendar コントロールの今日の値をプログラムにより設定できます。このプロパティは System.DateTime オブジェクトを使用して設定します。
メモ |
---|
TodaysDate プロパティによって指定された日付の外観は、TodayDayStyle プロパティを使用してカスタマイズできます。
TodaysDate プロパティを使用して、Calendar コントロールの今日の日付の値をプログラムによって設定する方法を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script language="VB" runat="server"> Sub Selection_Change(sender As Object, e As EventArgs) Calendar1.TodaysDate = Calendar1.SelectedDate Label1.Text = "Today's Date is now " & Calendar1.TodaysDate.ToShortDateString() End Sub 'Selection_Change </script> </head> <body> <form runat="server"> <h3>Calendar Example</h3> Select a date on the Calendar control to use as today's date.<br><br> <asp:Calendar ID="Calendar1" runat="server" SelectionMode="Day" ShowGridLines="True" OnSelectionChanged="Selection_Change"> <SelectedDayStyle BackColor="Yellow" ForeColor="Red"> </SelectedDayStyle> </asp:Calendar> <hr><br> <asp:Label id="Label1" runat=server /> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script language="C#" runat="server"> void Selection_Change(Object sender, EventArgs e) { Calendar1.TodaysDate = Calendar1.SelectedDate; Label1.Text = "Today's Date is now " + Calendar1.TodaysDate.ToShortDateString(); } </script> </head> <body> <form runat="server"> <h3>Calendar Example</h3> Select a date on the Calendar control to use as today's date.<br><br> <asp:Calendar ID="Calendar1" runat="server" SelectionMode="Day" ShowGridLines="True" OnSelectionChanged="Selection_Change"> <SelectedDayStyle BackColor="Yellow" ForeColor="Red"> </SelectedDayStyle> </asp:Calendar> <hr><br> <asp:Label id="Label1" runat=server /> </form> </body> </html>
<%@ Page Language="JScript" AutoEventWireup="True" %> <html> <head> <script language="JScript" runat="server"> function Selection_Change(sender : Object, e : EventArgs) { Calendar1.TodaysDate = Calendar1.SelectedDate; Label1.Text = "Today's Date is now " + Calendar1.TodaysDate.ToShortDateString(); } </script> </head> <body> <form runat="server"> <h3>Calendar Example</h3> Select a date on the Calendar control to use as today's date.<br><br> <asp:Calendar ID="Calendar1" runat="server" SelectionMode="Day" ShowGridLines="True" OnSelectionChanged="Selection_Change"> <SelectedDayStyle BackColor="Yellow" ForeColor="Red"> </SelectedDayStyle> </asp:Calendar> <hr><br> <asp:Label id="Label1" runat=server /> </form> </body> </html>
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Weblioに収録されているすべての辞書からCalendar.TodaysDate プロパティを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からCalendar.TodaysDate プロパティ を検索
- Calendar.TodaysDate プロパティのページへのリンク