This is a migrated thread and some comments may be shown as answers.

RadGridView thousand separator problem

1 Answer 635 Views
GridView
This is a migrated thread and some comments may be shown as answers.
pcprogrammer9
Top achievements
Rank 1
pcprogrammer9 asked on 31 Oct 2019, 07:28 AM

hi every one  

i using data-table to bind data-source of radgridview from SQL database . one of my radgridview column is a numeric . i want to apply thousand separator to that column (like 91000 => 91,000).

i change radgridview formatstring properties to "{0:n0}" and datatype to "System.Decimal" from design view . and set thousand-seperator properties to true.

but still noting change and number on than column view without thousand separator , please help .

 

 

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 31 Oct 2019, 11:16 AM

Hello,

According to your description, it seems that you are on the right way to show a thousand separator. I suppose that you use GridViewDecimalColumn which displays data from any numeric type. Please refer to the following code snippet which result is demonstrated below:

DataTable dt = new DataTable();
dt.Columns.Add("DecimalColumn", typeof(decimal));

dt.Rows.Add(100000);
dt.Rows.Add(200000);
dt.Rows.Add(300000);
dt.Rows.Add(400000);
dt.Rows.Add(500000);
dt.Rows.Add(600000);
this.radGridView1.DataSource = dt;

GridViewDecimalColumn decimalColumn = radGridView1.Columns["DecimalColumn"] as GridViewDecimalColumn;
decimalColumn.ThousandsSeparator = true;
decimalColumn.FormatString = "{0:n0}";

I hope this helps. Should you have any other questions, I will be glad to help.

Regards,
Nadya
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
pcprogrammer9
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or