Saturday, May 30, 2009

URL Parameters for Dynamic JS and CSS

/*
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("");
}

if (Key.ToString().ToLower().Trim() ="script")
{
string script= Request.QueryString.Get(Key.ToString().Trim());
Response.Write("");
}
}
%>

No comments:

Post a Comment