This is a migrated thread and some comments may be shown as answers.

Disable RadDatePicker Default Validation

1 Answer 184 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Debajyoti
Top achievements
Rank 1
Debajyoti asked on 01 Mar 2011, 11:38 PM
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 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Mar 2011, 05:53 AM
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.
Tags
Calendar
Asked by
Debajyoti
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or