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

Run Startup JS Code after Telerik JS Objects Exist

2 Answers 65 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 02 Feb 2010, 12:58 AM
// Find the RadControl client object, if null then exit the function  
sb.Append(String.Format("var co = $find(\"{0}\");", c.ClientID));  
sb.Append("if (co == null) return;");
 

When I register this code with the Page.ClientScript.RegisterStartupScript method it attempts to execute before the Telerik Control Javascript objects are created resulting in "co" being assigned a null value.  How do I register startup Javascript code that executes AFTER the Telerik javascript objects are created.

2 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 03 Feb 2010, 11:22 AM
Hi Eric,

The client-side objects of the controls are available after the MS AJAX framework has been initialized. You need to either place your code in a function named pageLoad or use the load event of Sys.Application:

Copy Code
function pageLoad()
{
}
 
// OR
 
// Attach a handler to the load event.
Sys.Application.add_load(applicationLoad);
 
function applicationLoad()
{
}

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Eric
Top achievements
Rank 1
answered on 03 Feb 2010, 01:18 PM
Perfect!  Thank you!
Tags
ScriptManager and StyleSheetManager
Asked by
Eric
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Eric
Top achievements
Rank 1
Share this question
or