Reading Selected Dates in a Date Range through the Calendar Control (VB.net)
<%@ Page Language=VB Debug=true %> <script runat=server> Sub calSelectChange(ByVal Sender as Object, ByVal E as EventArgs) Dim i as Integer lblMessage.Text = "You selected:" For i = 0 to MyCal.SelectedDates.Count - 1 lblMessage.Text = lblMessage.Text & "<BR>" _ & MyCal.SelectedDates(i).ToShortDateString() Next End Sub </SCRIPT> <HTML> <HEAD> <TITLE>Reading Selected Dates in a Date Range through the Calendar Control</TITLE> </HEAD> <BODY LEFTMARGIN="40"> <form runat="server"> Select a Date <BR><BR> <asp:calendar id="Mycal" runat="server" cellpadding="3" cellspacing="3" selectionmode="DayWeekMonth" selectorstyle-font-bold="True" selectorStyle-backcolor="#3366ff" font-name="Tahoma" font-size="12" backcolor="ivory" selecteddaystyle-backcolor="#ffcc66" selecteddaystyle-font-bold="True" onselectionchanged="calSelectChange" /> <BR><BR> <asp:Label id="lblMessage" runat="server" Font-Bold="True" /> </form> </BODY> </HTML>