Asp.Net GridView DataFormatString Problem
<asp:TemplateField HeaderText="Number">
<ItemTemplate>
开发者_Python百科 <asp:Label ID="LblNbr" runat="server" Text='<%# Eval("Number","{0:N0}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</column>
</asp:GridView>
Output Format: 3,333,333
I need Output Format: 3.333,333
This is because of the culture you are using. If you need some specific format than use your own culture with NumberFormatInfo (http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx) defined as you need.
You can set use it like this:
CultureInfo someCulture = new CultureInfo("en-US");
someCulture.NumberFormat.NumberDecimalSeparator = ",";
someCulture.NumberFormat.NumberGroupSeparator = ".";
Thread.CurrentThread.CurrentCulture = someCulture;
精彩评论