CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
CS1061: 'string' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'string' could be found
- Article ID:
6251 - Date Created
Thursday, June 16, 2022 - This Article Has been Viewed
337 times - Short Desc
CS1061: 'string' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'string' could be found - Details
When testing an asp.net web application you may encounter the following error if your component is misnamed.
CS1061: 'string' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) - Recreate Issue
The error is generated when asp.net component ID is misnamed.
Example
<asp:Label ID="LabelOne" runat="server" Text="Label"></asp:Label>
And CodeFile or CodeBehind is this
Label1.Text = "Page set to Upload!"; - Resolve Issue
As demonstrated above, the ID is LabelOne, but in CodeFile or CodeBehind, we have Label1 as the ID for the label.
To correct the issue, ensure all component IDs match their corresponding CodeBehind source.
<asp:Label ID="LabelOne" runat="server" Text="Label"></asp:Label>
And CodeFile or CodeBehind is this
LabelOne.Text = "Page set to Upload!";
Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24695
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21297
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19544
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 17785
- The backup set holds a backup of a database other than the existing 16826