Hi, guys
I've done the following and worked fine
(Inserting the link of the stylesheet.css
)System.Web.UI.HtmlControls.HtmlGenericControl myStyleCss = new System.Web.UI.HtmlControls.HtmlGenericControl("link");
myStyleCss.Attributes.Add("href", "mystyle");
this.Page.Header.Controls.Add(myStyleCss);
This is what I would like to accomplish programatically in C# is to add the content of the css without referencing the link of the stylesheet.css as followed/
System.Web.UI.HtmlControls.HtmlGenericControl myStyleCss = new System.Web.UI.HtmlControls.HtmlGenericControl("style");
myStyleCss.Attributes.Add("type", "text/css");
body {margin: 0px;}
input {font-size: 10pt;}
#div.tag {vertical-align: middle;}
this.Page.Header.Controls.Add(myStyleCss);
Any Idea How to?
TIA

Arul RRank #2,478 · 566 reputationPosted Jan 6, 2016, 2:52 AM EST
Francis SusaimichaelRank #466 · 5.4K reputationPosted Jan 6, 2016, 3:20 AM EST
style.TagName = "style";
style.Attributes.Add("type", "text/css");
style.InnerHtml = "body{background-color:#000000;} input {background-color:yellow;} ";
Page.Header.Controls.Add(style);
Jose SaizRank #5,346 · 302 reputationPosted Jan 8, 2016, 1:49 AM EST
Jose SaizRank #5,346 · 302 reputationPosted Jan 8, 2016, 1:50 AM EST
Francis SusaimichaelRank #466 · 5.4K reputationPosted Jan 8, 2016, 3:30 AM EST