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

Load of javascript in usercontrol

3 Answers 80 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ahrensberg
Top achievements
Rank 1
Ahrensberg asked on 03 Nov 2009, 12:28 PM
Hi folks,

I use a radtabstrip to load usercontrols on demand pretty much like the example at TabStrip / Load on Demand RadPageView. On my usercontrol I have javascript code in a radcodeblock, but this code is not loaded into the page if I use ajax.

In my testpage I have a function showing a normal javascript alert, which is called from an asp button. If i include the code below (to retrive the usercontrol via ajax), the button doesn't work, bot do I remove the ajax updater, and by this update the full site by loading an usercontrol there is no problems.

<telerik:AjaxSetting AjaxControlID="RadTabStrip1"
    <UpdatedControls> 
        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" /> 
        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanUnderRadWin" /> 
    </UpdatedControls> 
</telerik:AjaxSetting> 
<telerik:AjaxSetting AjaxControlID="RadMultiPage1"
    <UpdatedControls> 
        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanUnderRadWin" /> 
    </UpdatedControls> 
</telerik:AjaxSetting> 

What should I do?

3 Answers, 1 is accepted

Sort by
0
Ahrensberg
Top achievements
Rank 1
answered on 03 Nov 2009, 12:50 PM
Found JavaScript not loaded when loading user control dynamically in an Ajax request which can solve the problem by use of ScriptManager.RegisterStartupScript, but isn't it possible to solve the problem another way and maintain the RadCodeBlock in the ascx-file?
0
Iana Tsolova
Telerik team
answered on 04 Nov 2009, 01:37 PM
Hello Ahrensberg,

Indeed, you can try wrapping the client-code in the user control into RadScriptBlock and see if this helps. Otherwise, try the suggestions in the mentioned forum thread.

Sincerely yours,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ahrensberg
Top achievements
Rank 1
answered on 04 Nov 2009, 02:14 PM
Hello Iana,

Thank you very much! ;o) That was exactly was I missed... :o)

Best regards,
Kenneth
Tags
Ajax
Asked by
Ahrensberg
Top achievements
Rank 1
Answers by
Ahrensberg
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or