2013-08-27 38 views
-1

here'is我的HTML:服务器标签不规范

<asp:Label ID="EmployeeIDlbl" runat="server" Text="<%# GetLabelCaption("Judges", "Employee Number",CaptionType.EditLabel) %>"></asp:Label> 

其中:CaptionStyle是我以前创建Enumerator,并GetLabelCaption函数返回一个字符串从SQL数据库中获取。

我想知道错误在哪里?

+0

您使用数据绑定表达式'<%#',但你可能需要简单的回声'<%=' – Tommi

+0

@Tommi - 你不能用'<%='服务器控件。你可以使用'<%#'。但为什么不使用代码隐藏呢? –

+0

确实。没有看到它是runat =“服务器”。 __为什么不使用代码隐藏而不是_有些人喜欢声明式风格。我不同意他们,但这是他们的权利。 – Tommi

回答

2

,你提到的文字如下把单引号:

<asp:Label ID="EmployeeIDlbl" runat="server" Text='<%# GetLabelCaption("Judges", "Employee Number",CaptionType.EditLabel) %>'></asp:Label> 

这将工作

2

你需要把文本内容在单引号(' ')代替双引号(" ")。因此,尝试这种

<asp:Label ID="EmployeeIDlbl" runat="server" Text='<%# GetLabelCaption("Judges", "Employee Number",CaptionType.EditLabel) %>'></asp:Label>