C# 服务器标记的格式不正确

C# 服务器标记的格式不正确,c#,html,C#,Html,这是我的HTML: <asp:Label ID="EmployeeIDlbl" runat="server" Text="<%# GetLabelCaption("Judges", "Employee Number",CaptionType.EditLabel) %>"></asp:Label> 其中:CaptionStyle是我以前创建的Enumerator,并且GetLabelCaption函数返回从sql数据库中获取的字符串 我想知道错误在哪里 在

这是我的HTML:

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

其中:
CaptionStyle
是我以前创建的
Enumerator
,并且
GetLabelCaption
函数返回从sql数据库中获取的字符串


我想知道错误在哪里

在提及文本的地方加上单引号,如下所示:

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


这将起作用

您需要将文本内容放在单引号
(“”)
中,而不是双引号
(“”)
。所以试试这个

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


您使用数据绑定表达式
@Tommi-实际上您不能使用
。没有看到它的runat=“server”。为什么不改用代码隐藏呢?有些男人只是喜欢声明式风格。我不同意他们的意见,但这是他们的权利。