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>
銫文件:
if (RadDtpFromDate.SelectedDate > RadDtpToDate.SelectedDate)
{
dateCompareValidator.IsValid = False;
return;
}
現在試試這個..................
什麼日期你輸入你的文本框 –
我通過使用日期選擇器輸入 – Husna5207
你有問題,當你輸入相同的日期,它不會給錯誤正確....當你離開始日期空白比它不給錯誤,這兩個密碼只有權利 –