RadGridView thousand separator problem

2 posts, 0 answers
  1. pcprogrammer9
    pcprogrammer9 avatar
    3 posts
    Member since:
    Sep 2019

    Posted 31 Oct 2019 Link to this post

    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 .

     

     

  2. Nadya
    Admin
    Nadya avatar
    303 posts

    Posted 31 Oct 2019 Link to this post

    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.
Back to Top