TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jose Saiz
1.5k
260
103.8k
HOW To add css content to the asp.net page header
Jan 6 2016 7:31 AM
Hi, guys
I've done the following and worked fine
(Inserting the link of the stylesheet.css
<LINK REL=StyleSheet HREF="style.css" TYPE="text/css" MEDIA=screen>
)
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
Reply
Answers (
5
)
asp.net gridview
asp.net Web API2.0