On Date and Month Selection Changed (VB.net)
<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
MyCal.SelectedDate = Today()
End Sub
Sub calSelectChange(ByVal Sender as Object, ByVal E as EventArgs)
lblMessage.Text = "You selected " _
& MyCal.SelectedDate
End Sub
Sub calMonthChange(ByVal source As Object, _
ByVal e As MonthChangedEventArgs)
lblMessage2.Text = "<BR>You changed from month " _
& e.PreviousDate.Month & " to month " _
& e.NewDate.Month & "."
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Calendar 2 Control Sample Page</TITLE>
</HEAD>
<BODY >
<form runat="server">
<Font Face="Tahoma">
<asp:Calendar
id="Mycal"
runat="server"
CellPadding="3"
CellSpacing="3"
DayNameFormat="Short"
FirstDayOfWeek="Default"
NextPrevFormat="FullMonth"
SelectionMode="Day"
ShowDayHeader="True"
ShowGridLines="False"
ShowNextPrevMonth="True"
ShowTitle="True"
TitleFormat="MonthYear"
Font-Name="Tahoma"
Font-Size="12"
BackColor="ivory"
TodayDayStyle-Font-Bold="True"
DayHeaderStyle-Font-Bold="True"
OtherMonthDayStyle-ForeColor="gray"
TitleStyle-BackColor="#3366ff"
TitleStyle-ForeColor="white"
TitleStyle-Font-Bold="True"
SelectedDayStyle-BackColor="#ffcc66"
SelectedDayStyle-Font-Bold="True"
WeekendDayStyle-Font-Italic="True"
NextPrevStyle-Font-Italic="True"
OnSelectionChanged="calSelectChange"
OnVisibleMonthChanged="calMonthChange"
/>
<BR><BR>
<asp:Label
id="lblMessage"
runat="server"
Font-Bold="True"
/><asp:Label
id="lblMessage2"
runat="server"
Font-Bold="True"
/>
</Font>
</Form>
</BODY>
</HTML>
Related examples in the same category