.aspx 文件:
<tr>
<td align="right">
Start Date:
</td>
<td align="left">
<telerik:RadDatePicker ID="RadDtpFromDate" runat="server" Calendar-EnableShadows="true" AutoPostBack="true"
Culture="en-IN" DateInput-DateFormat="dd-MMM-yyyy" DateInput-EmptyMessage="DD-MMM-YYYY"
ShowPopupOnFocus="true" ToolTip="Input Date" ZIndex="30001"
onselecteddatechanged="RadDtpFromDate_SelectedDateChanged" />
<asp:RequiredFieldValidator runat="server" ID="rfvFromDate" Display="None" ControlToValidate="RadDtpFromDate"
InitialValue="" ValidationGroup="FinalSave" ErrorMessage="From Date is Mandatory"
ForeColor="Red"></asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="vceFromDate" TargetControlID="rfvFromDate"
runat="server">
</ajaxToolkit:ValidatorCalloutExtender>
<asp:CustomValidator ID="cvFromDate" runat="server" ControlToValidate="RadDtpFromDate"
Display="None"></asp:CustomValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="vceRadFromDate" runat="server" TargetControlID="cvFromDate">
</ajaxToolkit:ValidatorCalloutExtender>
</td>
<td align="right">
End Date:
</td>
<td align="left" colspan="2">
<telerik:RadDatePicker ID="RadDtpToDate" runat="server" Calendar-EnableShadows="true" AutoPostBack="true"
Culture="en-IN" DateInput-DateFormat="dd-MMM-yyyy" DateInput-EmptyMessage="DD-MMM-YYYY"
ShowPopupOnFocus="true" ToolTip="Input Date" ZIndex="30001"
onselecteddatechanged="RadDtpToDate_SelectedDateChanged" />
<asp:RequiredFieldValidator runat="server" ID="rfvToDate" Display="None" ControlToValidate="RadDtpToDate"
InitialValue="" ValidationGroup="FinalSave" ErrorMessage=" To Date is Mandatory"
ForeColor="Red"></asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="vceToDate" TargetControlID="rfvToDate"
runat="server">
</ajaxToolkit:ValidatorCalloutExtender>
<asp:CustomValidator ID="cvToDate" runat="server" ControlToValidate="RadDtpToDate"
Display="None"></asp:CustomValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="vceRadToDate" runat="server" TargetControlID="cvToDate">
</ajaxToolkit:ValidatorCalloutExtender>
</td>
</tr>
Cs 文件:
if (RadDtpFromDate.SelectedDate > RadDtpToDate.SelectedDate)
{
dateCompareValidator.IsValid = False;
return;
}
现在试试这个......