<p>ASP.NET 3.5 SP1 adds a great new ScriptCombining feature to the ScriptManager object as demonstrated on <a href="http://www.asp.net/learn/3.5-SP1/video-296.aspx?wwwaspnetrdirset=1" rel="nofollow noreferrer">this video</a>. However he only demonstrates how to use the feature with the ScriptManager on the same page. I'd like to use this feature on a site where the scriptmanager is on the master page but can't figure out how to add the scripts I need for each page programmatically to the manager. I've found <a href="http://seejoelprogram.wordpress.com/2008/08/19/net-35-sp1-doesnt-provide-composite-script-registration-from-an-iscriptcontrol-out-of-the-box/" rel="nofollow noreferrer">this post</a> to use as a starting point, but I'm not really getting very far. can anyone give me a helping hand?</p>

<p>Thanks, Dan</p>

Give this a shot:
```
```
ScriptReference SRef = new ScriptReference();
    SRef.Path = "~/Scripts/Script.js";

    ScriptManager.GetCurrent(Page).CompositeScript.Scripts.Add(SRef);
```
```
That will get the current scriptmanager (even if it is on a master page) and add a script reference to the CompositeScript properties.