I finally got it to work this way:
<asp:Calendar ID="startCalendar" CssClass="startDate"
OnSelectionChanged="Selection_Changed" runat="server"></asp:Calendar>
<asp:CustomValidator ID="dateCustVal" OnServerValidate="DateCustVal_Validate"
runat="server"></asp:CustomValidator>
protected void DateCustVal_Validate(object source, ServerValidateEventArgs args)
{
if (startCalendar.SelectedDate == null
|| startCalendar.SelectedDate == new DateTime(0001, 1, 1, 0, 0, 0))
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…