Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bind to textbox with string.format

Tags:

asp.net

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>
like image 914
Eyal Avatar asked Dec 27 '22 12:12

Eyal


1 Answers

You could use the following overload which allows you to specify the format:

<%# Bind("Price", "{0:#,###}") %>
like image 161
Darin Dimitrov Avatar answered Jan 20 '23 11:01

Darin Dimitrov