Disable RadDatePicker Default Validation

2 posts, 0 answers
  1. Debajyoti
    Debajyoti avatar
    3 posts
    Member since:
    Jun 2010

    Posted 01 Mar 2011 Link to this post

    Hello,
    The RadDatePicker has default validation for any invalid date. It is working fine. But ,this does not work for me. For a invalid date , current as is implementation keeps the focus on the RadDatePicker control with a Warning image (like a triangle).

    My requirement is to put the error message just below the RadDatePicker control, Not inside the control. I want to get rid of the image. Is there way I can disable the default behaviour and implement the custom behaviour using a javascript ?

    Thanks,
    Deba 
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Mar 2011 Link to this post

    Hello Deba,

    You can attach the client event OnError and handle the error there. Here is a sample code to achieve the same.

    aspx:
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" Width="150px" AutoPostBack="false">
        <DateInput DateFormat="dd MMM yyyy" ClientEvents-OnError="ShowMessage">
        </DateInput>
    </telerik:RadDatePicker>
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>

    Javascript:
    function ShowMessage()
     {
        document.getElementById("Label1").innerText="InvalidDate!!";//setting label text
     }

    You can hide the default alert icon by overriding the default CSS like below.
    CSS:
    .riError
           {
               background-image:none !important;
           }



    Thanks,
    Shinu.
Back to Top