How to validate Telerik RadDatePicker for the invalid input?

360 Views Asked by At

I have 2 Telerik RaddatePicker controls and the button.

<table class="moss2Search">
    <tr>
        <td>
            <div runat="server">
                <telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker1" width="100%"  runat="server" DateInput-Label="Boarding Start Date">
                </telerik:RadDatePicker>
             </div>
        </td>
        <td>
            <div runat="server">
                <telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker2" width="100%"  runat="server" DateInput-Label="Boarding End Date">
                </telerik:RadDatePicker>
            </div>
        </td>
        <td>
            <div> 
              <asp:CheckBox ID="chkMerActive" runat="server" Checked="true"/>Active
            </div>
        </td>
        <td>
           <%--<asp:Button ID="btnSeacrh" runat="server" Text="Search" OnClick="btnSearch_Click" OnClientClick="return dateValidation();"/> <br />--%>
            <telerik:RadButton RenderMode="Lightweight" runat="server" Text="Search" ID="Button1" OnClick="btnSearch_Click" OnClientClicked="validateDates" AutoPostBack="false"></telerik:RadButton>
        </td>
    </tr>

</table>

How can I validate these 2 controls for a valid date selected, since the user can type a string value as well?

1

There are 1 best solutions below

0
On

Use the standard validation that comes with the framework. If the user input can be a date the components will have a value, otherwise null or the default so you can also check against that in a a custom validation rule