2.0: Anybody Repair The Broken MSDN Code Examples?

C

clintonG

Neither MSDN code examples [1] nor [2] will function.

Has anybody figured out how to use the 2.0 classes, methods and properties
to dynamically create HTML in the HTML <head> element?
I've burned through everything I could find using google.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1] http://msdn2.microsoft.com/en-us/library/zbtxhd34
[2] http://msdn2.microsoft.com/en-us/library/h2bbdsaw
 
J

Juan T. Llibre

re:
Neither MSDN code examples [1] nor [2] will function.

Code example 1 works. See it working at :
http://asp.net.do/test2/AddStylesheet.aspx
View Source to see the stylesheet link added to the head.

Code example 2 works. See it working at :
http://asp.net.do/test2/Page.Header.aspx
View Source to see the title and body style added to the head.

All I did was copy the example provided, verbatim, Clinton.
Go get some coffee!

;-)




clintonG said:
Neither MSDN code examples [1] nor [2] will function.

Has anybody figured out how to use the 2.0 classes, methods and properties to
dynamically create HTML in the HTML <head> element?
I've burned through everything I could find using google.

<%= Clinton Gallagher

[1] http://msdn2.microsoft.com/en-us/library/zbtxhd34
[2] http://msdn2.microsoft.com/en-us/library/h2bbdsaw
 
C

clintonG

I tried both examples using C# and VB and neither loaded or ran without
error.

Since posting I've got IStyleSheetCS running.

The HtmlLink Class example still would not run when requested by a browser
until I added the System.Web.UI.HtmlControls Namespace. Then the StyleSheet
would not load. So I tried using the example with VS2005 an a code-behind
model which results in the following error...

/ /CS0117: 'System.Web.UI.IPageHeader' does not contain a definition for
'Controls'
Page.Header.Controls.Add(myHtmlLink);

<%= Clinton Gallagher



Juan T. Llibre said:
re:
Neither MSDN code examples [1] nor [2] will function.

Code example 1 works. See it working at :
http://asp.net.do/test2/AddStylesheet.aspx
View Source to see the stylesheet link added to the head.

Code example 2 works. See it working at :
http://asp.net.do/test2/Page.Header.aspx
View Source to see the title and body style added to the head.

All I did was copy the example provided, verbatim, Clinton.
Go get some coffee!

;-)




clintonG said:
Neither MSDN code examples [1] nor [2] will function.

Has anybody figured out how to use the 2.0 classes, methods and
properties to dynamically create HTML in the HTML <head> element?
I've burned through everything I could find using google.

<%= Clinton Gallagher

[1] http://msdn2.microsoft.com/en-us/library/zbtxhd34
[2] http://msdn2.microsoft.com/en-us/library/h2bbdsaw
 
J

Juan T. Llibre

re:
I tried using the example with VS2005 an a code-behind model which results in the
following error..

The code in those pages is meant to be used inline.

System.Web.UI.HtmlControls.HtmlHead subclasses System.Web.UI.IPageHeader

http://beta.asp.net/QUICKSTART/util...a3a&namespace=System.Web.UI&class=IPageHeader





clintonG said:
I tried both examples using C# and VB and neither loaded or ran without error.

Since posting I've got IStyleSheetCS running.

The HtmlLink Class example still would not run when requested by a browser until I added
the System.Web.UI.HtmlControls Namespace. Then the StyleSheet would not load. So I tried
using the example with VS2005 an a code-behind model which results in the following
error...

/ /CS0117: 'System.Web.UI.IPageHeader' does not contain a definition for 'Controls'
Page.Header.Controls.Add(myHtmlLink);

<%= Clinton Gallagher


Juan T. Llibre said:
re:
Neither MSDN code examples [1] nor [2] will function.

Code example 1 works. See it working at :
http://asp.net.do/test2/AddStylesheet.aspx
View Source to see the stylesheet link added to the head.

Code example 2 works. See it working at :
http://asp.net.do/test2/Page.Header.aspx
View Source to see the title and body style added to the head.

All I did was copy the example provided, verbatim, Clinton.
Go get some coffee!

;-)




clintonG said:
Neither MSDN code examples [1] nor [2] will function.

Has anybody figured out how to use the 2.0 classes, methods and properties to
dynamically create HTML in the HTML <head> element?
I've burned through everything I could find using google.

<%= Clinton Gallagher

[1] http://msdn2.microsoft.com/en-us/library/zbtxhd34
[2] http://msdn2.microsoft.com/en-us/library/h2bbdsaw
 
C

clintonG

How could that be? Anyway, I only attempted to move the HtmlLink Class
example to code-behind after the embedded script block model would not
function for me.

And what does your reference to IPageHeader imply?

<%= Clinton Gallagher

Juan T. Llibre said:
re:
I tried using the example with VS2005 an a code-behind model which
results in the
following error..

The code in those pages is meant to be used inline.

System.Web.UI.HtmlControls.HtmlHead subclasses System.Web.UI.IPageHeader

http://beta.asp.net/QUICKSTART/util...a3a&namespace=System.Web.UI&class=IPageHeader





clintonG said:
I tried both examples using C# and VB and neither loaded or ran without
error.

Since posting I've got IStyleSheetCS running.

The HtmlLink Class example still would not run when requested by a
browser until I added
the System.Web.UI.HtmlControls Namespace. Then the StyleSheet would not
load. So I tried
using the example with VS2005 an a code-behind model which results in the
following
error...

/ /CS0117: 'System.Web.UI.IPageHeader' does not contain a definition for
'Controls'
Page.Header.Controls.Add(myHtmlLink);

<%= Clinton Gallagher


Juan T. Llibre said:
re:
Neither MSDN code examples [1] nor [2] will function.

Code example 1 works. See it working at :
http://asp.net.do/test2/AddStylesheet.aspx
View Source to see the stylesheet link added to the head.

Code example 2 works. See it working at :
http://asp.net.do/test2/Page.Header.aspx
View Source to see the title and body style added to the head.

All I did was copy the example provided, verbatim, Clinton.
Go get some coffee!

;-)




message
Neither MSDN code examples [1] nor [2] will function.

Has anybody figured out how to use the 2.0 classes, methods and
properties to
dynamically create HTML in the HTML <head> element?
I've burned through everything I could find using google.

<%= Clinton Gallagher

[1] http://msdn2.microsoft.com/en-us/library/zbtxhd34
[2] http://msdn2.microsoft.com/en-us/library/h2bbdsaw
 
C

clintonG

<snip />

Just to clarify my last reply... I read the Interface documentation and
tried using an instance of an HtmlHead object as follows. The page now loads
but the StyleSheet does not.

Is it correct to say you implied I needed to subclass IPageHeader by using
the System.Web.UI.HtmlControls Namespace and the HtmlHead class in
particular. Is that correctly stated?

Regardless, this code will load the page but will not load StyleSheet.css.

// Define an HtmlLink control.
HtmlLink myHtmlLink = new HtmlLink();
myHtmlLink.Href = "StyleSheet.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");

// Add the HtmlLink to the Head section of the page.
// ERROR: 'System.Web.UI.IPageHeader' does not contain a definition for
'Controls'
Page.Header.Controls.Add(myHtmlLink);

HtmlHead head = new HtmlHead();
head.Controls.Add(myHtmlLink);

<%= Clinton Gallagher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top