Where to put the <style> in the content page ?
Hi Matt Sollars,
Where we can put this code? In the content page load event or Master page load event?
I tried it with content page load event.
but still my styles have not applied to the my data grid.
I have a data grid control in one of my content place holder page.
I have a theme style sheet in "../App_Themes/mystyles.css"
I put this code...but can u help me out
// Add a style sheet link.
HtmlGenericControl Style = new HtmlGenericControl();
Style.Attributes.Add("type", "text/css");
Style.Attributes.Add("rel", "stylesheet");
Style.Attributes.Add("href", "../App_Themes/company/mystyles.css");
Header.Controls.Add(Style);
I have some styles for my data grid in this css clas. how can I make it?
pls help
Matt Sollars said:
Try one of the following in your page's Load event handler.
// Add a style sheet link.
HtmlGenericControl Style = new HtmlGenericControl();
Style.Attributes.Add("type", "text/css");
Style.Attributes.Add("rel", "stylesheet");
Style.Attributes.Add("href", "MyStyle.css");
Header.Controls.Add(Style);
// Add inline style.
HtmlGenericControl Style = new HtmlGenericControl();
Style.InnerText = "h1 { color: #0F0; } .MySelector { background-color:
#F90; }";
Header.Controls.Add(Style);
Good luck!
- Matt
----- Original Message -----
From: ad
Date: 8/4/2006 2:29 AM
> I use vs2005 to develop web application.
> I have used the new feature of master page of VS2005, and I have put some
> <style> in the master page.
> But I want to override some Style sheet in the content page.
> Where to put the <style> in the content page ?
>
>