c# - 是否可以为 asp :Calendar 添加新的下一个和上一个按钮

标签 c# asp.net calendar

asp.Net Calendar 在日历日名称上提供了 Next 和 Previous 按钮,但我不喜欢它。我正在尝试像 Google 日历一样在日历外添加下一个和上一个按钮。那么是否可以将 MonthChangedEventArgs 添加到按钮,这样我就可以像使用 asp.Net Calendar 提供的 OnVisibleMonthChanged 一样使用它。

FYI: When you click on the next button then the month changes. Just like when you use e.NewDate and e.Previous from MonthChangedEventArgsDate and then use .VisibleDate to update the calendar

最佳答案

参见 this文章,我能够使用它来创建一个下拉框,让您可以选择月份。它比按钮或超链接更好,因为我可以从 2 月转到 12 月,而无需多次点击。这是一个屏幕截图:

enter image description here

Here is the article.

这是一个working demo for you

您具体需要的代码是:

public void Set_Calendar(object Sender, EventArgs E)
{
    cntCalendar.TodaysDate = Convert.ToDateTime(drpCalMonth.SelectedItem.Value + " 1, " + drpCalYear.SelectedItem.Value);
}

关于c# - 是否可以为 asp :Calendar 添加新的下一个和上一个按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8227479/

相关文章:

c# - 如何在后台启动 PhantomJS + Selenium 窗口?

c# - ASPxCombobox,允许用户输入和下拉选择

c# - 在 C# 中为我的应用程序编写 API

c# - 自定义 Ajax 工具包 Html 编辑器控件

calendar - RFC 5545 与 RFC 2445 有何不同

C# 安全地构建 SQL 字符串以使用 Entity Framework 执行

asp.net - 电子邮件 token 在 15 分钟后过期 - Asp Identity 2.0 API

.net - ASP.Net https 与 http

java - 公历给我 2018 年 int 月份 = calendar.get(Calendar.FEBRUARY)

net.java.ao.Entity 中的 java.util.Date