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

2 posts, 0 answers
  1. shaik
    shaik avatar
    15 posts
    Member since:
    Dec 2007

    Posted 07 Apr 2008 Link to this post

    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


  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 08 Apr 2008 Link to this post

    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
Back to Top