Victor Garcia Aprea : Whidbey support for HtmlHead, Intro

Subscriptions

<December 2008>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Post Categories




Whidbey support for HtmlHead, Intro

Very simple questions as “How can I programmatically set my Page’s title from codebehind?” or “How can I handle my Page’s <head> element from codebehind?” were, are and will be asked about every single day in the public newsgroups, forums, etc.

 

This is because v1.x doesn’t include any built-in support for handling the <head> element or any of its children elements.

 

This leads to the common approach of adding the runat=’server’ attribute to the <head> element and then handling it as a HtmlGenericControl. Pretty simple and pretty unfriendly stuff at the same time. In addition, having VS.NET removing the attribute at will just make things more annoying.

 

After looking at all the feedback from newsgroups, forums, etc, it was pretty obvious that something was needed. Because of this, the HtmlHead control was born in the PDC03 bits (and others like HtmlTitle and HtmlLink did appear in the March04 bits). The Page type itself was modified to include these additions and new properties were added: Header (in the PDC03 bits) returns an instance of a type that implements IPageHeader (HtmlHead in this case) and Title (in the March04 bits) just wraps a Header.Title call.

 

So now, this is how you handle this very common need in the Whidbey bits:

 

void Page_Load (object sender, EventArgs e) {

     this.Header.Title = “This is a title”;

     this.Header.LinkedStyleSheets.Add (“classicblue.css”);

     this.Header.Metadata.Add (“author”,”clarius”);
}

 

Pretty simple, ugh? No doubt, this is a good addition. Hopefully all the confusion and how-to questions that plagued the newsgroups about how to deal with this in v1.x won’t be there for v2.0 (now that’s a wish).

 

While playing with this new supported I discovered a few “issues” that I describe in these posts (warning: the following info may be more than you ever wanted to know about <head> and its child elements):

 

Whidbey Support For HtmlHead, Part I – What title will be rendered?

Whidbey support for HtmlHead, Part II – Not only VS.NET messes up your markup

Whidbey support for HtmlHead, Part III – The missing ViewState

 

posted on Monday, April 19, 2004 1:46 AM by vga

# Casinos online @ Sunday, January 14, 2007 2:40 PM

Great site keep the good working [url=http://casinosonline.da.cx">http://casinosonline.da.cx ][/url]
Find casinos online with the best <a href="http://casinosonline.da.cx">http://casinosonline.da.cx">Casino online</a> Free bonus for your deposit.
Get gambling casinos bonus and learn how to win http://casinosonline.da.cx">http://casinosonline.da.cx gambling online

Gambling online

# mp3 ringtones @ Monday, March 05, 2007 12:28 PM

<a href='http://www.yahoo.com'></a> http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com/tones/">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com/tones/ <a href='http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com'>real ringtones</a>. <a href="http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com ">motorola ringtones</a>: ringtones site free, ringtones site, Free nokia ringtones here. [url]http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com/ring/[/url] [link=http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com]tracfone ringtones[/link] from site .

mp3 ringtones

# mp3 ringtones @ Monday, March 05, 2007 12:31 PM

<a href='http://www.yahoo.com'></a> http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com/tones/">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com/tones/ <a href='http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com'>real ringtones</a>. <a href="http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com ">motorola ringtones</a>: ringtones site free, ringtones site, Free nokia ringtones here. [url]http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com/ring/[/url] [link=http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com">http://www.la-ringtones.com]tracfone ringtones[/link] from site .

mp3 ringtones

# funny ringtones @ Monday, March 05, 2007 12:32 PM

http://www.la-ringtones.com">http://www.la-ringtones.com/mp3/">http://www.la-ringtones.com">http://www.la-ringtones.com/mp3/ ringtones site. [URL=http://www.la-ringtones.com">http://www.la-ringtones.com]qwest ringtones[/URL]: ringtones site free, ringtones site, Free nokia ringtones here. [url=http://www.la-ringtones.com">http://www.la-ringtones.com]nextel ringtones[/url] from website .

funny ringtones

# funny ringtones @ Monday, March 05, 2007 12:32 PM

http://www.la-ringtones.com/mp3/ ringtones site. ringtones site free, ringtones site, Free nokia ringtones here. from website .

funny ringtones

# nxuhcf0@search.com @ Monday, March 05, 2007 12:33 PM

ringtones free

nxuhcf0@search.com

# funny ringtones @ Monday, March 05, 2007 12:34 PM

http://www.la-ringtones.com">http://www.la-ringtones.com/mp3/">http://www.la-ringtones.com">http://www.la-ringtones.com/mp3/ ringtones site. [URL=http://www.la-ringtones.com">http://www.la-ringtones.com]qwest ringtones[/URL]: ringtones site free, ringtones site, Free nokia ringtones here. [url=http://www.la-ringtones.com">http://www.la-ringtones.com]nextel ringtones[/url] from website .

funny ringtones

# re: Whidbey support for HtmlHead, Intro @ Friday, February 01, 2008 2:37 PM

GodPI4 <a href="http://byfkhtaxfxnk.com/">byfkhtaxfxnk</a>, [url=http://vlcvrdwalaic.com/]vlcvrdwalaic[/url], [link=http://bucauoheyxrw.com/]bucauoheyxrw[/link], http://kdkoiqvuamer.com/

wwarjfq

# umguagiv @ Tuesday, February 05, 2008 1:45 AM

[URL=http://aggxedyl.com]iitvmbbq[/URL] <a href="http://kohklsaq.com">qvbiljyj</a> oxtuzlrg http://yoxehvro.com iunwvrsl pvbdzeep

umguagiv

# re: Whidbey support for HtmlHead, Intro @ Monday, May 12, 2008 10:20 PM

cje56v <a href="http://jxtridrzljsi.com/">jxtridrzljsi</a>, [url=http://enpuefkbgvem.com/]enpuefkbgvem[/url], [link=http://ihgtrisrcmgo.com/]ihgtrisrcmgo[/link], http://qilqcapeoggi.com/

dkcnbfxfbuw

# re: Whidbey support for HtmlHead, Intro @ Wednesday, September 10, 2008 1:56 AM

iYKdq7 <a href="http://tqrgnfmboreb.com/">tqrgnfmboreb</a>, [url=http://bsnztvjmndxb.com/]bsnztvjmndxb[/url], [link=http://deuzoeozlbwi.com/]deuzoeozlbwi[/link], http://monuudxlvevk.com/

rakxis

# re: Whidbey support for HtmlHead, Intro @ Monday, November 03, 2008 7:23 PM

7qxDJ5 <a href="http://dzavcgbhwomj.com/">dzavcgbhwomj</a>, [url=http://rlwflsdnjzlj.com/]rlwflsdnjzlj[/url], [link=http://fyuqmbwsjwjb.com/]fyuqmbwsjwjb[/link], http://uihlfvbavbql.com/

rzajfelgy