开发者

how to bind the data in gridview amount format 123,456.00?

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}"> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜