Adding dynamically to RadScriptManager

2 posts, 0 answers
  1. Mike
    Mike avatar
    2 posts
    Member since:
    Jun 2015

    Posted 20 Jul 2015 Link to this post

    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");


  2. Peter Filipov
    Peter Filipov avatar
    1028 posts

    Posted 23 Jul 2015 Link to this post

    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
  3. DevCraft R3 2016 release webinar banner
Back to Top