Here's an idea that needs a little fleshing out.
I was trying to think about how to include a control with and without scripts, depending on whether the page wanted the ajaxified version of the control or not...
Define 2 standard content place holders in all your controls, one for the presentation and another for your scripts, for example...
<asp:Content ID="Content1" ContentPlaceHolderID="PresentationPlaceHolder" runat="server">
<!-- Html goes here -->
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptPlaceHolder" runat="server">
<script type="text/javascript" src="myscript.js"></script>
<script type="text/javascript">
// script goes here
</script>
</asp:Content>
Then define 2 master pages, one with the two place holders called WithScript.master...
<asp:ContentPlaceHolder ID="PresentationPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="ScriptPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
... and one with just the presentation called WithoutScript.master...
<asp:ContentPlaceHolder ID="PresentationPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
Then when you call RenderView( "MyControl", "WithScript", viewData ); you'll get both the presentation and the script. And if you use "WithoutScript" you'll just get the html.
This won't work as it stands because you'll get Cannot find ContentPlaceHolder 'ScriptPlaceHolder' in the master page '...\WithoutScript.master'.
Of course you could easily write a simple NullContentPlaceHolder which would simply black hole the scripts. But, better yet, you could write a type of ContentPlaceHolder which would save the output of all such place holders in an object which you could access from the Site.master. so as you are rendering controls, the scripts are getting dumped into a StringBuilder which you can output at the end of the page...
You could also do some duplication removal...?
Like i said this needs fleshing out...
Maybe there's something the framework could do to help us out? does RoR have good script/control separation // control reusability story?