I have a problem when binding the data in gridview. I am attempting to display the amount field in USA format like 123,456.00. How would I go about this with data binding?
The code I have so far is:
<asp:TemplateField HeaderText="Amount">
<ItemTemplate>
&开发者_开发百科lt;asp:Label ID="lblAmount" runat="server" Text='<%# Eval("Amount") %>'>
</asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="right" VerticalAlign="Middle" />
</asp:TemplateField>
you can do this by dataformat string or you need any more help go through this link
format data string
<asp:BoundField DataField="amount" HeaderText="amount"
ReadOnly="True" SortExpression="amount" DataFormatString="{0:n3}" />
<asp:boundcolumn datafield="Price" headertext="Tax" dataformatstring="{0:C}">
精彩评论