[英]Text in a bound asp.net page
I have an asp.net page in a VS2010 project. 我在VS2010项目中有一个asp.net页面。 I've bound the page to a dataset, and I have a line in the front end which looks like this:
我已将页面绑定到数据集,并且前端有一行如下所示:
<asp:Label ID="lblInCommon" runat="server" Text='<%#Eval("NumInterests") %>' >
</asp:Label>
Works perfect. 完美的作品。
Now, what I want to do is append the word "Interests" to the label. 现在,我要在标签上附加“兴趣”一词。 So, I tried this:
所以,我尝试了这个:
<asp:Label ID="lblInCommon" runat="server" Text='<%#Eval("NumInterests") %> Interests'>
</asp:Label>
Doesn't like it. 不喜欢 So I tried this:
所以我尝试了这个:
<asp:Label ID="lblInCommon" runat="server" Text="'<%#Eval("NumInterests") %>' Interests">
</asp:Label>
Doesn't like that either. 也不喜欢。 Can anyone tell me how to do this?
谁能告诉我该怎么做? I'm at the point where I'm ready to just put 2 labels back-to-back, but I have to believe this is possible to do in the same label.
我已经准备好将两个标签背对背放置,但是我必须相信这可以在同一标签中完成。
You should be able to do the following: 您应该能够执行以下操作:
<asp:Label ID="lblInCommon" runat="server" Text='<%#Eval("NumInterests") + "Interests" %>' >
Inside <%# %> is basically just evaluated code so you can treat it as such and even do things like call functions. 在<%#%>内部基本上只是评估的代码,因此您可以将其视为此类,甚至可以执行诸如调用函数之类的事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.