views:

15

answers:

1

I have a page with this in the head

<style type="text/css">
    #columnList { list-style-type: none; margin: 0; padding: 0; width: 95%; }
    #columnList li { margin: 0 3px 3px 3px; padding: 0.1em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
    #columnList li span { position: absolute; margin-left: -1.3em; }
    .column { font-size: small; border:1px solid; background-color: lightyellow; }
     body { background : beige }
</style>
<link rel="StyleSheet" href="css/dashCss.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jcolor/jscolor.js"></script>
<script type="text/javascript" src="js/dashboard.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"&gt;&lt;/script&gt;    

And now I want to move that page into an aspx user control but dont know what to do with the head stuff... help?

A: 

1) Either add it to the pages that will use the user control manually or 2) If you use the ASP.NET AJAX framework, use the ScriptManager and ScriptManagerProxy to manage your scripts. ScriptManager goes at the top of the page, or in the master page, and ScriptManagerProxy can go in any number of user controls. You can put the ScriptManagerProxy in your user control, register your scripts in the section, and these get wired up to the ScriptManager and registered at the ScriptManager location.

In the user control, the ScriptManagerProxy would look like:

<asp:ScriptManagerProxy id="smp" runat="server">
  <Scripts>
     <asp:ScriptReference Path="~/js/jquery.js" />
  </scripts>
</asp:ScriptManagerProxy>

Just make sure that the site master page or the page using this user control has this at the top, but within the form.

<asp:ScriptManager id="sm" runat="server" />

Or 3) Programmably add them from code-behind; get the pages header reference, and add script tags programmatically.

Brian
Ok, the ScriptManager/ScriptManagerProxy thing sounds like my answer. I've never used them, will have to look it up.Thanks!
toddv
Very easy, I'll post a quick sample.
Brian