asp.net日历控件。日期选择后,从当前2天 [英] asp.net calendar control. Date selectable after 2 days from the current

查看:202
本文介绍了asp.net日历控件。日期选择后,从当前2天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以限制哪些日期在日历控件如选择,这样,日期只能被选择一次,它至少两天前?

Is it possible to restrict which dates are selectable in the calendar control eg so that a date can only be selected once it's at least two days ago?

推荐答案

您可以处理Calendar控件的的 的DayRender 事件中的这个论坛讨论):

You can handle the calendar control's DayRender event to control which days are visible/selectable (as seen in 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;
}

这篇关于asp.net日历控件。日期选择后,从当前2天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆