Author: Jeremy Edmiston
URL: http://www.bytemycode.com/snippets/snippet/553/
This snippet allows an aspx page (c#) to accept URL parameters to allow styles or script to be dynamically appended to the rendered page.
I wrote this simple snippet to allow one of our vendors to accept a style override so that their application would morph into something more closely resembling our own portal application. Please see screenshots for clarification.
/*
URL Parameters for Dynamic JS and CSS
--
This snippet allows an aspx page (c#) to accept URL parameters to
allow styles or script to be dynamically appended to the rendered
page.
I wrote this simple snippet to allow one of our vendors to accept
a style override so that their application would morph into
something more closely resembling our own portal application.
Please see screenshots for clarification.
*/
<%
foreach (object Key in Request.QueryString)
{
if (Key.ToString().ToLower().Trim() ="style")
{
string style= Request.QueryString.Get(Key.ToString().Trim());
Response.Write("<link rel='stylesheet' type='text/css' href='"+ style + "'/>");
}
if (Key.ToString().ToLower().Trim() ="script")
{
string script= Request.QueryString.Get(Key.ToString().Trim());
Response.Write("<script type='text/javascript' src='"+ script+ "'></script>");
}
}
%>










