This is a migrated thread and some comments may be shown as answers.
Tabstrip, Ajax, Usercontrols
1 Answer 25 Views
This is a migrated thread and some comments may be shown as answers.
Sam Stange
Top achievements
Rank 1
Sam Stange asked on 05 May 2009, 12:19 AM
Hoping someone can help me... I've got a tab strip and some usercontrols I load dynamically. I'm using both the RadControls for ASP.NET and the RadControls with Ajax. 1st, I can't use javascript in my usercontrols. I've tried registering the clientscript onload, using the radscriptblock, using the radcodeblock, with no luck. As soon as I turn off ajax on the manager, everything loads up correctly. I'm using the same approach as:

http://www.telerik.com/community/forums/aspnet-ajax/tabstrip/dynamic-user-controls-in-multipageview.aspx

Is there another kind of trick or best practice when it comes to registering javascript in a web usercontrol? Should I place the scripts in a centralized .js file?

Thanks,

Sam

1 Answer, 1 is accepted

Sort by
0
Todd Anglin
Top achievements
Rank 2
answered on 06 May 2009, 05:24 AM
If you want JavaScript to fire when the page loads, try using the ASP.NET AJAX pageLoad event handler, like this:

function pageLoad(){
//Your code here
}

That event will get automatically fired by ASPNET AJAX when the page is ready to go. You can use this in your UserControl and it should fire correctly.

Let me know if that helps.

-Todd
Tags
Ajax
Asked by
Sam Stange
Top achievements
Rank 1
Answers by
Todd Anglin
Top achievements
Rank 2
Share this question
or