views:

18

answers:

1

Is there a way to use a skin file in a theme only when a certain browser is used?

The theme stays the same, I just want skin A to apply when a certain browser is used, and skin B when another browser is used. I know I can have server-side code to check and then set the SkinId of the control to either or, but is there another, more global way?

Thanks

+1  A: 

You can test for what browser the user is using, and then set the theme programatically that way.

An example might be:

protected void Page_PreInit(object sender, EventArgs e)
{

    System.Web.HttpBrowserCapabilities browser = Request.Browser;
    if (browser.ToUpper().IndexOf("IE") >= 0)
    {
            Page.Theme = "BlueTheme";
    }
    else
    {
            Page.Theme = "PinkTheme";
    }
}
womp