I am trying to schedule speakers for the Knoxville .NET User's Group for 2006. If anyone is interested in speaking over the next couple of months, shoot me an email here. We are still looking for a speaker this month also. It may appear that I am a lazy no-good-for-nothing for waiting until the last second but I have been trying. I may in fact be just that but I am still new at this.
I had a bit of trouble figuring this one out. I needed to include a script in a MasterPage dynamically based on the url/path of the current page. Eventually, I found the ClientScriptManager.RegisterClientScriptInclude method. Here is a short snippet:
if
(Request.RawUrl.ToLower().IndexOf("/client") > 0)
{
cs.RegisterClientScriptInclude("ClientScripts", "../../Scripts/ClientScripts.js");
}
else if (Request.RawUrl.ToLower().IndexOf("/contacts") > 0)
{
cs.RegisterClientScriptInclude("ContactScripts", "../../Scripts/ContactScripts.js");
}
That is all well and good but ClientScriptManager is the real jewel here. Anyone that has had to manage client scripts in ASP.NET 1.x knows what a pain it is and the ClientScriptManager makes it so easy. I can count at least a dozen instances it would have been gold to have it with 1.x.