R
Rob Roberts
In a VS2005 ASP.NET project, I'm trying to find a way to change which css
file is linked in based on the browser type. I'd like to use one css file
for IE browsers, and a different one for all other browsers. I'm using a
MasterPage. I added a Literal control to the Head section of the
MasterPage, and then in the Page_Load event I set its Text property to set
up the desired link, like this:
StyleSheetLiteral.Text = "<link rel=\"stylesheet\" type=\"text/css\"
href=\"/inc/content_ie.css\">";
This works, but the VS2005 IDE reports it as an error, with message
"Unrecognized tag prefix or device filter 'asp'." Plus I can't help
thinking that there must be a better way.
I also tried setting the Page.StyleSheetTheme property in the Page_Load
event, but this gives a System.InvalidOperation exception when the page
loads. The documentation for Page.StyleSheetTheme says that it must be set
before the page's Init event completes, but I can't figure out how to access
that event in the MasterPage.
Any ideas on the best way to accomplish setting the style sheet dynamically?
Thanks in advance,
--Rob Roberts
file is linked in based on the browser type. I'd like to use one css file
for IE browsers, and a different one for all other browsers. I'm using a
MasterPage. I added a Literal control to the Head section of the
MasterPage, and then in the Page_Load event I set its Text property to set
up the desired link, like this:
StyleSheetLiteral.Text = "<link rel=\"stylesheet\" type=\"text/css\"
href=\"/inc/content_ie.css\">";
This works, but the VS2005 IDE reports it as an error, with message
"Unrecognized tag prefix or device filter 'asp'." Plus I can't help
thinking that there must be a better way.
I also tried setting the Page.StyleSheetTheme property in the Page_Load
event, but this gives a System.InvalidOperation exception when the page
loads. The documentation for Page.StyleSheetTheme says that it must be set
before the page's Init event completes, but I can't figure out how to access
that event in the MasterPage.
Any ideas on the best way to accomplish setting the style sheet dynamically?
Thanks in advance,
--Rob Roberts