簡體   English   中英

ASP.Net數據綁定到帶有文本的標簽控件

[英]ASP.Net data binding to label control with text

如何添加文本到帶有綁定數據的標簽?

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") %>'

Eval函數有一個采用格式字符串的重載:

Text='<%# Eval("DeliveryPrice", "£: {0}") %>'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM