Thousand Separator

4 posts, 1 answers
  1. Tooraj
    Tooraj avatar
    74 posts
    Member since:
    Aug 2010

    Posted 25 Oct 2010 Link to this post

    Hi,
    I want to show contents of GriView column with thousand separator, please write a sample code.
    Thank you, Tooraj Azizi.
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 25 Oct 2010 Link to this post

    Hello Tooraj,

    In order to achieve this behavior you can register for the DataBindingComplete event, and enable the ThousandSeparator for the DecimalColumn.
    void radGridView1_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
    {
        var decimalColumn = radGridView1.Columns["DecimalColumn"] as GridViewDecimalColumn;
        decimalColumn.ThousandsSeparator = true;
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  3. Rutuja
    Rutuja avatar
    2 posts
    Member since:
    Jul 2017

    Posted 04 Aug 2017 in reply to Emanuel Varga Link to this post

    Hi , I tried to use this code but its not working.

    The column name is 'amount' and I added this code, please can you help me in this.

    private void radGridView2_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
    {

    var decimalColumn = radGridView2.Columns["Amount"] as GridViewDecimalColumn;
    decimalColumn.ThousandsSeparator = true;
    }

  4. Dimitar
    Admin
    Dimitar avatar
    2892 posts

    Posted 07 Aug 2017 Link to this post

    Hello Rutuja,

    Please note that this formats the value in the editor only. If you want it to be visible in the cells when not editing you need to set the format string:
    var decimalColumn = radGridView1.Columns[0] as GridViewDecimalColumn;
    decimalColumn.ThousandsSeparator = true;
    decimalColumn.FormatString = "{0:n}";

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top