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

RadAjaxManager & User Control JavaScript

1 Answer 42 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jibber4568
Top achievements
Rank 1
Jibber4568 asked on 07 Nov 2012, 12:26 PM
Hi Guys,

I'm experiencing a problem and was hoping you may be able to point out if there is a way round it.

I have a radtabstrip that is dynamically loading user controls on click via the radajaxmanager.

This all works as expected except the user controls all contain javascript on them.
None of the javascript is recognised when loaded via the radajaxmanager and thus a number of controls on the page don't function correctly.

How should I be implementing javascript within a user control that is loaded dynamically via the radajaxmanager?

Thanks

1 Answer, 1 is accepted

Sort by
0
Thad
Top achievements
Rank 2
answered on 09 Nov 2012, 01:21 PM
Hi Jibber,

Do you have the JavaScript in your UserControl wrapped in a RadScriptBlock?  When Ajax is involved, this is the only way the JavaScript will be preserved after partial page postbacks. 

http://www.telerik.com/help/aspnet-ajax/ajax-radscriptblock-radcodeblock.html

<telerik:RadScriptBlock runat="server" ID="rsbInitialize">
    <script type="text/javascript">

       
window.$ = window.$telerik.$;
        $F.initializeSite();
        window.Sys.Application.add_load($F.Navigation.initialize);
    </script>
</telerik:RadScriptBlock>

Let us know if that helps,
Thad
Tags
Ajax
Asked by
Jibber4568
Top achievements
Rank 1
Answers by
Thad
Top achievements
Rank 2
Share this question
or