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
ande.Previous
fromMonthChangedEventArgsDate
and then use.VisibleDate
to update the calendar
最佳答案
参见 this文章,我能够使用它来创建一个下拉框,让您可以选择月份。它比按钮或超链接更好,因为我可以从 2 月转到 12 月,而无需多次点击。这是一个屏幕截图:
您具体需要的代码是:
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/