简体   繁体   English

如何在asp:Calendar中选择“选定日期”?

[英]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.

相关问题 如何在单个日历控件中从asp.net日历控件中选择日期范围 - How to select date range from a asp.net calendar control in a single calendar control 如何在日历中捕获所选日期更改事件? - How to catch the selected date changed event in calendar? 在日历中突出显示所选日期 - Highlight selected date in Calendar 如何从日历中选择日期(日期选择器) - How to select date from calendar (datepicker ) 如何基于从asp.net c#中的两个日历控件(DateFrom到Dte to)中选择的日期在gridview中显示文件名 - How to display Filenames in gridview on the basis of date selected from two calendar controls (DateFrom to Dte to) in asp.net c# 在文本框中插入日期,然后在日历asp.net中选择该日期c# - Insert a date into a textbox and then that date would be selected in the calendar asp.net c# 如何将所选日期从AJAX日历控件传递到存储过程 - How to pass selected date from AJAX calendar Control into stored procedure DateTimePicker:如果用户在弹出式日历中单击/选择日期,该如何处理? - DateTimePicker: How will I handle if the user clicked/selected date in the popup calendar or not? 如何清除 UWP、C# 中的日历日期选择器选定值 - How to clear Calendar Date Picker Selected Values in UWP, C# ASP.NET MVC 视图需要将选定的下拉列表和日历日期传递给 model - ASP.NET MVC view needs to pass selected dropdown and Calendar date to model
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM