not able to find RadDatePicker by using $find() function

2 posts, 0 answers
  1. Veeresh
    Veeresh avatar
    2 posts
    Member since:
    Jun 2012

    Posted 13 Jun 2012 Link to this post

    Hello developers,
    function getDate()
          var date = $find("<%= RadDatePicker1.ClientID %>");
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server">

    I am using the above code to find RadDatePicker using JavaScript, but not able to find the control, date is giving null value. i search a lot but didn't get. please help me out what i have to change in my application.
  2. Vasil
    Vasil avatar
    1642 posts

    Posted 14 Jun 2012 Link to this post

    Hi Veeresh,

    When you call the getDate() function ?
    If the function is called before the object is created, then it will be null.
    The JavaScript on your page is executed in the sequence that it is loaded in your page. So for example:

    var a = find("<%= RadDatePicker1.ClientID %>");
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
    var b = find("<%= RadDatePicker1.ClientID %>");

    "a" will be null and "b" will be the correct object.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top