[英]How to select the “selected Date” in asp:Calendar?
The question sounds illogical, but it is not: 这个问题听起来不合逻辑,但不是:
I have 2 dates "Target" and "Actual". 我有两个日期“目标”和“实际”。 Usually the "Actual" date is very close to "Target", but not necessarily to the current date. 通常,“实际”日期与“目标”非常接近,但不一定与当前日期一致。 To avoid the multiple clicks in the calendar that would navigate you to the month/year of interest, I set the selected date to my "Target" date when it is opened. 为了避免在日历中多次单击而将您导航到感兴趣的月份/年份,我将选择的日期设置为“目标”日期(打开后)。 This works great, BUT does not allow me to select that day, with the calendar closing automatically after selecting. 效果很好,但是我不允许选择那天,选择后日历自动关闭。
Any idea to solve this or any known alternative? 有解决这个问题或任何已知替代方案的想法吗?
If you have a Calendar1 component, you can use a code like: 如果您有Calendar1组件,则可以使用如下代码:
DateTime tomorrow = DateTime.Today.AddDays(1);
Calendar1.TodaysDate = tomorrow;
Calendar1.SelectedDate = Calendar1.TodaysDate;
When this calendar changed SelectionChanged the selected date, you can set the other calendar. 当此日历更改SelectionSelected更改所选日期时,您可以设置其他日历。
Tell me if you need more detail. 告诉我您是否需要更多细节。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.