AddParsedSubObject breaks after upgrading to VS.NET 2005 RC

S

Steve Franks

Hi All,

The following code was working just fine in Visual Studio 2005 Beta 2, but
breaks now that I've upgraded to the RC build:

public void setMetaValues(string metaKey, string metaVal)
{
HtmlMeta metadata = new HtmlMeta();
metadata.Attributes.Add(metaKey, metaVal);
Page.Header.AddParsedSubObject(metadata);
}

That compiles just fine in Beta 2, but in the RC build I get this on the
Page.Header.AddParsedSubObject line::
Compiler Error Message: CS1540: Cannot access protected member
'System.Web.UI.Control.AddParsedSubObject(object)' via a qualifier of type
'System.Web.UI.HtmlControls.HtmlHead'; the qualifier must be of type
'MyTemplate' (or derived from it)

NOTE: "MyTemplate" is the name of my masterpage. The setMetaValues method
shown above is declared inside of the codebehind of my MyTemplate
masterpage.

Can someone please let me know what I'm doing wrong and how to make this
same type of thing work in the RC build? I noticed that AddParsedSubObject
no longer comes up in Intellisense when I press the "." after Page.Header so
something in the API must have changed - not sure what the correct new
approach is though.

Basically I'm just looking to be able to easily add a "keywords" and
"description" tag to the meta info sent in a web page. In case it matters, I
have multiple levels of masterpages involved. For instance MyTemplate2 is a
master page that inherits from MyTemplate, and from a webform created from a
MyTemplate2 master page I need to be able to set these header values.

Thanks,

Steve
 
S

Scott Allen

Hi All,

The following code was working just fine in Visual Studio 2005 Beta 2, but
breaks now that I've upgraded to the RC build:

public void setMetaValues(string metaKey, string metaVal)
{
HtmlMeta metadata = new HtmlMeta();
metadata.Attributes.Add(metaKey, metaVal);
Page.Header.AddParsedSubObject(metadata);
}

Use Page.Header.Controls.Add(metadata);. Exposing AddParsedSubObject
in beta2 was a flaw.

HTH,
 

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,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top