所以目前我有这 3 个验证器
<asp:RegularExpressionValidator ID="dashboardFromDateDateCheck" runat="server" ValidationExpression="[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]"
ControlToValidate="filterFromDate" ErrorMessage="Invalid From Date Format, (mm/dd/yyyy)" Text="*"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ID="dashboardToDateDateCheck" runat="server" ValidationExpression="[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]"
ControlToValidate="filterToDate" ErrorMessage="Invalid To Date Format, (mm/dd/yyyy)" Text="*"></asp:RegularExpressionValidator>
<asp:CompareValidator ID="checkDashboardFilterDateRange" runat="server" ControlToValidate="filterFromDate" ControlToCompare="filterToDate" Type="Date"
Operator="LessThanEqual" ErrorMessage="From Date must be before To Date" Text="*"/>
但我只希望比较验证器在两个日期都有效并且两个日期都输入的情况下工作。因为在我的搜索中,他们可以将日期留空或只输入从或到日期。