2012-02-20 67 views
0

我想这个代码访问的属性,但它给了我一个错误:如何访问javaScript中的asp.net属性?

<textarea class="<%#Eval("soort").ToString() %>" ID="TextTranslation" runat="server" rows="5"><%#Eval("Translation") %></textarea> 

错误:

Server Error in '/' Application.
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 server tag is not well formed.

Source Error:

Line 17:
Line 18: <%# (Eval("IsoCode").ToString() != Eval("Default").ToString()) ? " hidden" : "" %>">
Line 19: " ID="TextTranslation" runat="server" rows="5"><%#Eval("Translation") %>
Line 20:
Line 21:

Source File: /assets/usercontrols/TranslationControl.ascx Line: 19

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

+0

这是一个服务器标记。你应该在代码中设置它的属性,而不是在标记中。如果它是无意的,你可以尝试删除runat =“server”。 – 2012-02-20 09:58:22

+7

检查您的报价:class ='<%#Eval(“soort”)。ToString()%>' – 2012-02-20 10:04:44

+0

可能是解决方案,但我不再在该项目中工作。我应该关闭这个问题吗? – SamekaTV 2012-02-22 08:48:14

回答

1

更改引号:类=” <%#的eval(” soort“)。ToString()%>'