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

Adding dynamically to RadScriptManager

1 Answer 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Mike asked on 20 Jul 2015, 08:32 PM

I would like to add two files into the radsciptmanager if the user is using a version of IE < 9.  My thought is that in the Page_Load I can test the users Browser and use an if statement to add in the 2 scripts. The reason being, these 2 files fix issues in IE 7&8 but they cause issues in IE 9&10. I have posted some code that I have tried out just not sure what I am missing or if it is possible. Is this possible with RadScriptManager? Thanks in advance.


 <telerik:RadScriptManager ID="RadScriptManager" runat="server" EnablePartialRendering="true"
            AsyncPostBackTimeout="1800" EnableCdn="true">
                <telerik:RadScriptReference Path="~/Scripts/​File1.js" />
                <telerik:RadScriptReference Path="~/Scripts/​File2.js" />
                <telerik:RadScriptReference Path="~/Scripts/File3.js" />


        if (type == "IE8" || type == "IE7")
            RadScriptManager rsmgr = new RadScriptManager();
            //ScriptManager smgr = ScriptManager.GetCurrent(Page);
            ScriptReference SRef = new ScriptReference("~/Scripts/File4.js");
            ScriptReference SRef1 = new ScriptReference("~/Scripts/File5.js");


1 Answer, 1 is accepted

Sort by
Peter Filipov
Telerik team
answered on 23 Jul 2015, 08:17 AM
Hello Mike,

Yes this is possible. Just declare the RadScriptManger on the page and access it from the code behind by its ID and add the script with if condition. To check which browser is making a request to your server, please parse the user agent string.

Peter Filipov
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
General Discussions
Asked by
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Share this question