是否可以限制日历控件中可选择的日期,例如,只有在至少两天前才能选择日期?
答案 0 :(得分:3)
您可以处理日历控件DayRender
event以控制哪些日期可见/可选(如this forum discussion所示):
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date >= DateTime.Now.Date && e.Day.Date <= DateTime.Now.AddDays(2))
e.Cell.Visible = true;
else
e.Cell.Visible = false;
}
答案 1 :(得分:1)
将其放入页面加载中:
Calendar1.SelectedDate = DateTime.Now.AddDays(2);