Is is possible to add
<!--[if IE 6]> .... <![endif]-->
On dynamically generated css or js file reference.
e.g
HtmlGenericControl ie6css = new HtmlGenericControl("link");
ie6css.Attributes.Add("rel", "stylesheet");
ie6css.Attributes.Add("src", Config.GetUrl("ie6/ie6-min.css"));
Page.Header.Controls.Add(ie6css);
will generate
<link href="ie6/ie6-min.css" rel="stylesheet">
I need to enclose generated css reference in some conditional statements.
Yes, it’s possible. You can read browser info from
Request.Browserin your server side code, and load content based on that. I’m not sure how dependable that is, and it’s easily faked, so I would only rely on it for style things (like it seems you’re doing).You could also detect the browser on the client side via JavaScript, then dynamically load style sheets at that point.