Is there a way to make the binding work with string format?
<asp:TemplateField HeaderText="Price" >
<EditItemTemplate>
<asp:TextBox ID="txtPrice" runat="server" Text='<%# String.Foramt("{0:#,###}",Bind("Price")) %>' />
</EditItemTemplate>
您可以使用以下重载,它允许您指定格式:
<%# Bind("Price", "{0:#,###}") %>
You can use overload form of DataBinder.Eval
<%# Eval("Price", "{0:#,###}") %>
Using Bind
<%= Bind("price", "{0:#,###}") %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.