Get selected date from asp:Calendar (VB.net)
<%@ Page Language="VB" %>
<script runat="server">
Sub Calendar1_SelectionChanged(sender As Object, e As EventArgs)
If Day (Calendar1.SelectedDate) = 13 And Calendar1.SelectedDate.DayOfWeek = 5 Then
Label1.Text = "Careful! Friday 13th is an unlucky day for some people!"
Else
Label1.Text = "It's just another day in life..."
End If
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
Please select a date:
</p>
<p>
<asp:Calendar id="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar>
</p>
<p>
<asp:Label id="Label1" runat="server"></asp:Label>
</p>
</form>
</body>
</html>
Related examples in the same category