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

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

1 Answer 131 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Veeresh
Top achievements
Rank 1
Veeresh asked on 13 Jun 2012, 05:06 AM
Hello developers,
function getDate()
  {
      var date = $find("<%= RadDatePicker1.ClientID %>");
  }
.aspx
<telerik:RadDatePicker ID="RadDatePicker1" runat="server">
</telerik:RadDatePicker>

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.

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 14 Jun 2012, 07:58 AM
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:

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

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

Greetings,
Vasil
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.
Tags
Calendar
Asked by
Veeresh
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or