Home   Cover Cover Cover Cover
 

Calendar


From Section 6.4.12 of the book

This example shows a Calendar control as an example of a highly sophisticated GUI element.

Calendar.aspx
<%@ Page Language="C#" Culture="en-US" %>
<html>
  <script Runat="server">
    void ShowDate(object sender, EventArgs e) {
      DateTime date = cal.SelectedDate;
      lab.Text = date.ToShortDateString();
    }
  </script>
  <body>
    <form Runat="server">
      <asp:Calendar ID="cal" OnSelectionChanged="ShowDate" Runat="server">
        <TitleStyle BackColor="Gray" />
        <DayStyle BackColor="LightGray" />
        <OtherMonthDayStyle ForeColor="Gray" />
        <SelectedDayStyle ForeColor="Red" Font-Bold="True" />
      </asp:Calendar><br>
      <asp:Label ID="lab" Runat="server" />
    </form>
  </body>
</html>

Try it

   http://dotnet.jku.at/book/samples/6/Calendar.aspx