0

I'm trying to combine multiple js file references using Telerik's script manager. Here is the code I have on page load:

        System.Web.UI.ScriptReference jsFile1 = new System.Web.UI.ScriptReference('/virtual_folder/jsfile1.js');
        System.Web.UI.ScriptReference jsFile2 = new System.Web.UI.ScriptReference('/virtual_folder/jsfile2.js');


        this.Master.ScriptManager.CompositeScript.Scripts.Add(jsFile1);
        this.Master.ScriptManager.CompositeScript.Scripts.Add(jsFile2);

I'm getting an error:

[NullReferenceException: Object reference not set to an instance of an object.] System.Collections.ObjectModel.Collection`1.Add(T item) +18

Telerik.Web.UI.RadScriptManager.Page_PreRenderComplete(Object sender, EventArgs e) +95

System.EventHandler.Invoke(Object sender, EventArgs e) +0

System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8695102

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029

What am I doing wrong?

1 Answer 1

1

I think that the script combining only works for embedded resources currently so you would have to embed your js Files inside a dll.

On a side note you know you can use

 this.Master.ScriptManager.

tried using

 RadScriptManager.GetCurrent(this)

I am assuming you are calling this from an aspx page and not an ascx control, otherwise you have to use this.Page.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.