I have two calendars. What I am trying to implement is based on the date selected in the first calendar, the date range in the second one will be from calendar1.selectedDate + 1 until indefinite.
So any of the dates < calendar1.selectedDate should not be selectable in calendar2.
How to set a range for a calendar, or at least set the start date?
asp:calendar has many attributes but just cannot find what I am looking for.
Thanks in advance.
Try this
For the second calendar control
<asp:Calendar ID="Calendar2" runat="server" ondayrender="Calendar2_DayRender"></asp:Calendar>
on DayRender event
protected void Calendar2_DayRender(object sender, DayRenderEventArgs e)
{
DateTime dte = Calendar1.SelectedDate;
if (e.Day.Date <= dte)
{
e.Day.IsSelectable = false;
e.Cell.ForeColor = System.Drawing.Color.Gray;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With