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

Javascript being added to the page too late

1 Answer 29 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 02 Oct 2012, 05:49 PM
I'm currently working with a page that sits inside of a nested master page and references a web user control. This web user control references any of 8 different other web user controls depending on what the user has selected.

My problem is that if I add the relevant javascript to the user control it is being rendered on the page too low and I'm getting:
 "function name" is not defined errors?

Some of my generic functions I can push up the hierarchy to higher pages, but some I just can't. How can I get my javascript higher on the page?

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 05 Oct 2012, 09:58 AM
Hi Jason,

You can use the method RegisterClientScriptBlock of ScriptManager in order to register a client-side script from the code-behind of your user control. The script will be added after the opening <form> tag of the page, which is the requirement in your case.

Feel free to contact us again if you run into more difficulties.

Kind regards,
Slav
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
General Discussions
Asked by
Jay
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or