如何使用绑定数据向标签添加文本?
Text='<%# Bind("DeliveryPrice") %>'
尝试显示£ 1.23。尝试了很多发布到论坛的例子,没有运气:
Text='<%# "£: " +Eval("DeliveryPrice").ToString() %>'
Text='<%# String.Format("£: {0}", Bind("DeliveryPrice")) %>'
Text="£" + '<%# Bind("DeliveryPrice") %>'
Text="£" & '<%# Bind("DeliveryPrice") %>'
Text='£ <%# DataBinder.Bind(Container.DataItem,"DeliveryPrice") %>'
Text='<%# "£" & Bind("DeliveryPrice") %>'
Text='<%# "£" + Bind("DeliveryPrice") %>'
答案 0 :(得分:0)
Eval
函数有一个带有格式化字符串的重载:
Text='<%# Eval("DeliveryPrice", "£: {0}") %>'