How to reset telerik:RadTimePicker to NULL or empty after clicking a button on a .ascx user control?

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    1 posts
    Member since:
    Jun 2013

    Posted 23 Jul 2013 Link to this post

    How to reset telerik:RadTimePicker to NULL or empty after clicking a button on a .ascx user control?

    Things that I tried, but not working:

    • Time.Clear(); in code
    • JavaScript - (It works on .aspx, but not .ascx)
     <script type="text/javascript">
         function clearTime(sender, args) {
            $find("<%= Time.ClientID %>").clear();
        }
    </script>
    <asp:Button ID="btnSave" runat="server" Text="Save" OnClientClick="clearTime"  />
    I get this error message:

    The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).


    Thanks

  2. Jayesh Goyani
    Jayesh Goyani avatar
    2733 posts
    Member since:
    May 2010

    Posted 25 Jul 2013 Link to this post

    Hello,

    Please add JS code inside RadCodeBlock.

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
                function clearTime(sender, args) {
               $find("<%= Time.ClientID %>").clear();
              }
    </script>
            
        </telerik:RadCodeBlock>


    Thanks,
    Jayesh Goyani
Back to Top