有没有办法用c#在asp.net中的日历控件中增加日期 [英] Is there a way to increment the dates in a calender control in asp.net with c#
本文介绍了有没有办法用c#在asp.net中的日历控件中增加日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这两个日历控件,一个用户输入日期,另一个我希望从用户选定日期开始增加日期3天...有没有办法可以做到? div class =h2_lin>解决方案
假设您在aspx页面上有Calendar1和Calendar2,将onselectionchanged事件添加到Calendar1:
< span class =code-keyword>< asp:日历 ID = Calendar1 runat = server
onselectionchanged = Calendar1_SelectionChanged > < / asp:日历 >
< asp:日历 < span class =code-attribute> ID = Calendar2 runat = 服务器 > < / asp:日历 >
在后面的代码中,在Calendar1_SelectionChanged事件处理程序中:
protected void Calendar1_SelectionChanged( object sender ,EventArgs e)
{
Calendar2.SelectedDate = Calendar1.SelectedDate.AddDays( 3 );
}
结束。
I got these 2 calender controls,one in which user inputs the date and in another one i want to increment the date by 3 days from the selected day of user...Is there a way i can do tat??
解决方案
Say you have Calendar1 and Calendar2 on the aspx page, add onselectionchanged event to Calendar1:
<asp:Calendar ID="Calendar1" runat="server" onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar> <asp:Calendar ID="Calendar2" runat="server"></asp:Calendar>
In the code behind, in the Calendar1_SelectionChanged event handler:
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { Calendar2.SelectedDate = Calendar1.SelectedDate.AddDays(3); }
The End.
这篇关于有没有办法用c#在asp.net中的日历控件中增加日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文