0

我想验证我的 ajax 日历,以便它只能设置为从当前日期起至少三个月。

在 c# 中使用 asp.net 非常好奇它是如何工作的。

到目前为止,这是我的代码:

        <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="WarrantyTB" Format="dd/MM/yyyy" PopupButtonID="WarrantyCal"></asp:CalendarExtender>
            <asp:TextBox ID="WarrantyTB" runat="server" MaxLength="10" Width="100%"></asp:TextBox>
4

2 回答 2

0

因此,如果您要验证的日期称为“myDate”,您可以通过以下方式在控制器/模型中进行检查:

if(myDate >= DateTime.Today.AddMonths(-3))
{ // Do stuff }
于 2013-07-01T15:03:09.553 回答
0

您将要使用范围验证器,这是一个示例:带有范围示例的 ajax 日历扩展器

于 2013-07-01T15:05:17.437 回答