<%@ Page Language="VB" %>
<html>
<head> 
<script runat="server">
  Sub myCal_OnSelectionChanged(Source As Object, E As EventArgs)
    Dim sel As Integer
    Dim i as integer
    Dim s as string
    sel = Mycal.SelectedDates.Count
    
     s = ""
     For i = 0 to sel-1
     	 
     	 'Format : Day of Week, Month, Date, Year (D Formatting)
 	
 	'***************从Beta1 到Beta 2版本，代码变化 ***********
 	'Beta 1 代码
 	's = s  + Mycal.SelectedDates.Item(i).Format( "D", DBNull )	+ ","
     	 
     	 'Beta 2 代码 小写 "d" 代表短日期
     	 '大写 "D" 代表长日期
     	 s = s +  Mycal.SelectedDates.Item(i).ToString("d")

     next	
   
    selDate.Text = s
  End Sub
  
  Sub mycal_OnVisibleMonthChanged(Source As Object, E As MonthChangedEventArgs)
  
  
  selDate.Text = "当前月 " + " " + E.NewDate.ToString() _
       + " 上一个月 : " + E.PreviousDate.ToString()
  
  End Sub

</script> 
</head>
<body style="background-color='beige'; font-family='verdana'; font-size='10pt'">
<form id="myForm" runat="server">
  <p>
    <asp:Label id="selDate" runat="server" />
  </p>
  <ASP:Calendar id="myCal"  runat="server"
  
             BackColor="#666699" ForeColor="black"
             BorderWidth="2"
             BorderStyle="Solid" BorderColor="Black"
             CellSpacing=2 CellPadding=2 
             ShowGridLines=true
  
             TitleStyle-BorderColor="#666699"
             TitleStyle-BorderWidth="3"
             TitleStyle-BackColor="DarkGray"	
             TitleStyle-Height="50px"
  
             DayHeaderStyle-BorderColor="teal"  
             DayHeaderStyle-BorderWidth="3"
             DayHeaderStyle-BackColor="teal"
             DayHeaderStyle-ForeColor="black"
             DayHeaderStyle-Height="20px"  
  
             DayStyle-Width="50px"
             DayStyle-Height="50px"
  
             TodayDayStyle-BorderWidth="3"
  
             WeekEndDayStyle-BackColor="teal"
             WeekEndDayStyle-Width="50px"
             WeekEndDayStyle-Height="50px"
  
             SelectedDayStyle-BorderColor="firebrick"
             SelectedDayStyle-BorderWidth="3"
  
             OtherMonthDayStyle-Width="50px"
             OtherMonthDayStyle-Height="50px"
             
             OnSelectionChanged="myCal_OnSelectionChanged"
             OnVisibleMonthChanged="mycal_OnVisibleMonthChanged"
             runat="server" 
             SelectionMode = "DayWeekMonth"
             
             
            
       />
</form>
</body>
</html>