Microsoft
Software
Hardware
Network
Question : 'string' does not contain a definition for 'Controls' and no extension method 'Controls' accepting a first argument of type 'string' could be found
after converting my project in VS 2008, I get an error when trying to add the literal control PageTitle
Error 1 'string' does not contain a definition for 'Controls' and no extension method 'Controls' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
Code Snippet:
1:
this.Title.Controls.Add(new LiteralControl(this.PageTitle));
Open in New Window
Select All
Answer : 'string' does not contain a definition for 'Controls' and no extension method 'Controls' accepting a first argument of type 'string' could be found
Is this a VS 2003 project that you are converting?
In framework 2.0 (VS 2005), the Title property was added to the Page class. I assume that you had an element in the page with the Id "Title"? If so, that control is not reachable by that name any more.
If you want to set the title of the page, use the Title property:
this.Title = this.PageTitle;
If you are using the element for something else, you have to assign a different Id to it so that you can reach it.
Random Solutions
Enabling/Disabling Outlook Anywhere and ActiveSync in Exchange 2007
Exchange 2007 - Test-SystemHealth (Upgrading servicepack 2)
How can I get an accurate age to display in an Access form?
Summarizing Data using Access 2007 and Excel 2007
Logon Failure: account currently disabled
Barracuda Message Archiver Outlook Add-in install with Group Policy
Union Select Problem
Repaint UserControl in DesignTime
How can I change the identity property of a column without setting the wrong seed?
XBox 360 saying NAT Type is Moderate. How can I connect to other gamers