Reputation: 3805
I'm converting classic ASP over to ASP.Net, and came up with this error for one of the pages:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The 'Text' property of 'asp:TextBox' does not allow child objects.
Source Error:
Line 120: <tr>
Line 121: <td>Compliment Art:</td>
Line 122: <td><asp:CheckBox runat="server" ID="mail_Comp_Art" /></td>
Line 123: </tr>
Line 124: <tr>
As you can see, I have an asp:CheckBox element, but I am getting an error as if it is an asp:TextBox. I really don't know what I'm doing wrong at this point, and am fairly tired now as well...
In the code behind, I am checking a variable, and if it's set to true, I have:
mail_Comp_Art.Checked = true;
This is not showing an error, though, in Visual Studio. Any insight would be appreciated.
EDIT
Oh wow... Now that I am more awake, I noticed that I had some code commented out, and it was causing the issue. Although the error showed it was the code that was not commented out. Very odd. The actual error was on line 117. I don't understand why it would have caused the error to begin with since it was commented out, or why it did not say it was that line instead of the one it does say is wrong...
Upvotes: 1
Views: 5058
Reputation: 11
I know this post is dead but i came here to post another solution, cuz this happen to me just a few seconds and I figured out the solution.
I had this line:
<asp:listitem value ="1">Español</asp:listitem>
And the compiler gave me the same error "The 'Text' property of 'asp:TextBox' does not allow child objects". Then I rewrite the same line but now with capitals, like this:
<asp:ListItem value ="1">Español</asp:ListItem>
Pressed debug and everything is working fine again.
I hope this helps someone else.
Upvotes: 1
Reputation: 37543
Transferred from comment:
The error looks like there is an asp:TextBox control somewhere around line 118/119. Can you post some of the surrounding code? Usually the line produced in the error isn't the actual problem but the first point at which the problem exposed itself.
Upvotes: 3
Reputation: 8303
Try deleting the designer generated file and then right click on the aspx file and select convert to web page, this will rebuild the designer file and might remove any gunk that managed to come across in the conversion
Upvotes: 0