Last post Aug 09, 2019 03:11 AM by Yang Shen
Aug 08, 2019 04:01 PM|sweetSteal|LINK
Aug 09, 2019 03:11 AM|Yang Shen|LINK
Calendar1.SelectionMode = 0;//whis does not work
As far as i know, you can't partially set the selectionmode of calendar. As for your requirement, it seems impossible through c# or js code if with the standard Calendar control of asp.net.
However, i found a matter of expediency: when customer select a week passed, you can refresh your page.
<form id="form1" runat="server">
<asp:Calendar ID="Calendar1" SelectionMode="DayWeek" OnSelectionChanged="Calendar1_SelectionChanged" OnDayRender="Calendar1_DayRender" runat="server"></asp:Calendar>
protected void Page_Load(object sender, EventArgs e)
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
if (e.Day.Date.CompareTo(DateTime.Today) < 0)
//Calendar1.SelectionMode = 0;//whis does not work
e.Day.IsSelectable = false; //this works
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
if (Calendar1.SelectedDate < DateTime.Today)
Here's the result: