My local machine is Turkish, if i run my asp.net aplication , i can see easly my decimal value from mysql database like below.it is my desire and everything is right what i want. i used "Text='<%#Eval("Veri","{0:N}")%>'". it is working great in my local but if i publish it result below. i want to see ny decimal like :
DB My LOCAL GridVIEW My Remote GridViewMy GridView Code:
<asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Veri">
<ItemTemplate>
<asp:TextBox ID="txtVeri" runat="server" MaxLength="16" Enabled="false" Text='<%#Eval("Veri","{0:N}")%>' CssClass="form-control input-sm" Style="width: 100%;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
This is my db decimal:
And my awesome result: ( I WANT THIS)
ON THE OTHER HAND : if i publish my asp.net application to Customer : ( I DONT WANT THIS)
With the snippet below you can set the specific number format settings for the page with the GridView on Page_PreInit
without changing the whole UI language. This will of course affect all number formats on the page, not just the GridView.
protected void Page_PreInit(object sender, EventArgs e)
{
CultureInfo newCultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone();
NumberFormatInfo numberFormatInfo = (NumberFormatInfo)newCultureInfo.NumberFormat.Clone();
numberFormatInfo.NumberDecimalSeparator = ",";
numberFormatInfo.NumberGroupSeparator = ".";
numberFormatInfo.NumberDecimalDigits = 2;
newCultureInfo.NumberFormat = numberFormatInfo;
System.Threading.Thread.CurrentThread.CurrentCulture = newCultureInfo;
}