如何增加或减少日期在C#中使用AJAX日历扩展?日历、日期、AJAX

2023-09-04 01:27:17 作者:坑爹又拼爹的年代i

我在我所用阿贾克斯日历扩展两个文本框。当我选择的文本框中的一个日期,它会自动加入一些几天或几个月填补其他文本框。

I have two textboxes in which I have used ajax calendar extender. When I choose a date from one of the text boxes, it should automatically fill the other textbox by adding some days or months.

我怎么能这样做?

推荐答案

请遵循这个例子和修改code。希望它能帮助。

Please follow this example and modify your code. Hope it helps.

<asp:UpdatePanel id="UpdatePanel1" runat="server">
<contenttemplate>
<cc2:CalendarPopup id="CalendarExtender1" runat="server" Width="71px" OnDateChanged="CalendarPopup1_DateChanged" AutoPostBack="True"></cc2:CalendarPopup>
<cc2:CalendarPopup id="CalendarExtender2" runat="server" Width="71px"></cc2:CalendarPopup>
</contenttemplate>
</asp:UpdatePanel>        

**Code behind:**

 protected void CalendarPopup1_DateChanged(object sender, EventArgs e)
    {
        CalendarPopup2.SelectedDate = CalendarPopup1.SelectedDate.AddDays(1); // you can add the number of days you want
    } 

另外,下面的链接可能给你关于这个主题更好地了解:

Also the following link might give you better insight on this topic:

http://www.dotnetcurry.com/ShowArticle.aspx?ID=149