我正在将经典 ASP 转换为 ASP.Net,但其中一个页面出现了这个错误:
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>
如您所见,我有一个 asp:CheckBox 元素,但我收到一个错误,好像它是一个 asp:TextBox。我真的不知道我现在做错了什么,现在也很累......
在后面的代码中,我正在检查一个变量,如果它被设置为 true,我有:
mail_Comp_Art.Checked = true;
不过,这在 Visual Studio 中并未显示错误。任何见解将不胜感激。
编辑
哇哦...现在我清醒多了,我注意到我有一些代码被注释掉了,这是导致问题的原因。虽然错误显示是代码没有被注释掉。很奇怪。实际错误在第 117 行。我不明白为什么它会导致错误开始,因为它被注释掉了,或者为什么它没有说它是那一行而不是它说的那一行是错误的.. .
请您参考如下方法:
转自评论:
该错误看起来像是第 118/119 行附近某处有一个 asp:TextBox 控件。你能发布一些周围的代码吗?通常错误中产生的行不是实际问题,而是问题暴露出来的第一个点。
