日历日期阻止 [英] Calendar date blocking
本文介绍了日历日期阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
任何人都可以帮我解决如何阻止日历控件中的所有日期直到当前日期。
解决方案
嗨专家
我通过查询从DB中选择了日期
"从约会中选择日期,其中Count(日期)> = 5" ;
我必须阻止我在Calendar控件中从DB检索的所有日期。如果我必须阻止一个日期(例如:28-6-2008),我可以使用编码阻止该日期
if(e.Day.Date =='' 28-6-2008'')
{
e.Day.IsSelectable = false;
e.Cell.BackColor = System.Drawing.Color.Brown;
}
但是从DB检索的值将是一组值,如
日期
--------------------
28-6-2008
29-6-2008
30-6-2008
如何在Calendar控件中阻止任何选定的日期集在页面加载
期间,您可以尝试以下操作:
在日期选择器控件的valueChanged事件处理程序中,
if(datePicker.Value< System.DateTime.Today)
{
datePicker.Value = System.DateTime.Today;
}
应该可以正常工作。
祝你好运
< blockquote>你好
如果它是一个Windows应用程序,你可以直接使用datetime picker的MinDate属性。只需将最小日期指定为当前日期
dateTimePicker1.MinDate = System.DateTime.Now;
在Web应用程序中我们有java脚本日历,我们可以直接删除过去的日期。
更好的后期申请类型和激励控制你正在使用的,然后它很容易给出确切的答案
问候
nmsreddi
Hi
Can anybody help me how to block all dates in calendar control till the current date.
解决方案
Hi Experts
I have selected date from DB by using query
"Select Date from Appointment where Count(date)>=5"
I have to block all dates that I retrieved from DB in Calendar control. If I have to block a single date (eg: 28-6-2008), I can block that date by using the coding
if (e.Day.Date ==''28-6-2008'')
{
e.Day.IsSelectable = false;
e.Cell.BackColor = System.Drawing.Color.Brown;
}
but the value retrieved from the DB will be the set of values like
Date
--------------------
28-6-2008
29-6-2008
30-6-2008
How can I block any of the selected set of dates in Calendar control during the page load
you could try the following:
in the valueChanged event handler of your date picker control,
if(datePicker.Value < System.DateTime.Today)
{
datePicker.Value = System.DateTime.Today;
}
should work ok.
good luck
Hello
if its a windows application you can directly use MinDate property of the datetime picker.just assign min date as current date
dateTimePicker1.MinDate = System.DateTime.Now;
in web application we have java script calenders ,where we can directly strike out the passed dates .
better post application type and the excat control what you are using ,then its easy to give exact answer
Regards
nmsreddi
这篇关于日历日期阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文