从中继器项目模板内部,如何设置输入类型(图像)控件标题属性?
在我的 C# 代码中,我有一个常量:
SITE_NAME = "my site";
我有一个中继器控件,在 itemtemplate 内我有一个输入控件:
<input type=image runat=server title="<%= SITE_NAME %>" />
我需要特殊语法来设置此值吗?它不会渲染字符串“my site”,而是渲染:
<%= SITE_NAME %>
即它不会将其解析为 C# 代码。
In my c# code, I have a constant:
SITE_NAME = "my site";
I have a repeater control, and inside the itemtemplate I have a input control:
<input type=image runat=server title="<%= SITE_NAME %>" />
Do I need special syntax to set this value? It isn't rendering the string "my site", rather it is rending:
<%= SITE_NAME %>
i.e. it isn't parsing it as c# code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在数据绑定模板中工作时,请使用 <%# %>而不是 <%= %>
When working within a databound template, use <%# %> instead of <%= %>