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

How can I clear a datepicker value on client side by java script?

1 Answer 567 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
shaik
Top achievements
Rank 1
shaik asked on 07 Apr 2008, 05:38 PM
  1. I have it Prometheus datepicker control in a form,ondateselected client side event I want to clear the datepicker and set the blank date.
  2. In client side function I’m checking my date(which is in hidden field) based on that value I want to deside the clear or not .I completed my logic part in function,only I stuck to clear the datepicker with blank date or clear the datepicker textbox.
Help me out to clear the date (which property) I need set.

Thanks & Regards
Shaik Mujeebuddin


1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 08 Apr 2008, 08:39 AM
Hello shaik,

In order to clear the date input when certain condition is met or your custom date validation criteria is not fulfilled, consider using the clear() method from the client-side API of RadCalendar Prometheus. Here is some example code:

        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
           <script type="text/javascript">  
                function DateSelected(sender, eventArgs)  
                {  
                  if(!<some_condition_goes_here>)  
                  {  
                    sender.clear();  
                  }  
                }  
           </script> 
        </telerik:RadCodeBlock> 
            <telerik:RadDatePicker ID="RadDatePicker1" runat="server">  
                <ClientEvents OnDateSelected="DateSelected" /> 
            </telerik:RadDatePicker> 

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Calendar
Asked by
shaik
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or