I've got an ASP.NET application that uses a mixture of ASP.NET AJAX (Including UpdatePanel) and jQuery written by several developers of differing backgrounds.
Some included scripts within the ScriptManager itself <asp:ScriptManager><Scripts><asp:ScriptReference....
, while others used Page.ClientScript.RegisterClientScriptInclude
in the code behind, and others used straight <script src="">
to include scripts.
I'd like to consolidate to a single way of handling this if possible, but I'm not sure what the pros/cons of each way are and which way is preferred.
One example would be:
protected override void Render(HtmlTextWriter writer)
{
Page.ClientScript.RegisterClientScriptInclude("jQuery", ResolveClientUrl("~/scripts/jquery/js/jquery-1.4.2.min.js"));
base.Render(writer);
}
vs
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/scripts/jquery/js/jquery-1.4.2.min.js" />
</Scripts>
</asp:ScriptManager>
vs
<script src="Scripts/jQuery/js/jquery-1.4.2.min.js" type="text/javascript"></script>