Using a STYLE block on a page with a Master Page

I have been asked this a few times, so I decided to write up a little article on it.

The problem is that when you are using master pages in asp.net, the <HEAD> is usually inside the master page template.  So if you are on a page that needs a 1 off change or addition to the style of the rest of the site, you are unable to create a <STYLE> element in your content page.

Well, you CAN create one, but then VS.Net won’t show you the designer for your page b/c it keeps asking you to clean up the HTML problems on your page.

The solution I have used is to create a 2nd content place holder in the master page head.  But, I might as well not duplicate effort here, as Rick Strahl has already written the article I am about to write (and apparently, even someone else beat him to the punch).

http://www.west-wind.com/WebLog/posts/5706.aspx

This works very well for this type of situation. 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s