我使用CompareValidator
来确保不能在开始日期之前设置完成日期。到目前为止没有任何乐趣,即使输入的开始日期设置在结束日期之前,它也会显示错误消息?这是我的代码:
<td class="question">
Finish Date and Time
</td>
<td>
<asp:TextBox runat="server" ID="TxtFinish" CssClass="answer" MaxLength="50" Width="100px"/>
<span class="mandatory">*</span>
<obout:Calendar ID="Calendar2" runat="server"
DatePickerMode="true"
TextBoxId="TxtFinish"
ShowTimeSelector="true"
TextSelectTime="Set Time">
</obout:Calendar>
<asp:CompareValidator id="CompareValidator1" runat="server"
ControlToCompare="txtDate" cultureinvariantvalues="true" display="Dynamic" enableclientscript="true" ControlToValidate="TxtFinish"
ErrorMessage="Start date must be earlier than finish date" type="Date"
setfocusonerror="true" Operator="GreaterThanEqual" text="The Start date must be set before the finish date"></asp:CompareValidator>
任何帮助将不胜感激。