2012-02-20 66 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()%>'