Formatstring values problem

2 posts, 0 answers
  1. Jean-Pierre
    Jean-Pierre avatar
    3 posts
    Member since:
    Nov 2017

    Posted 28 Dec 2018 Link to this post

    I'm a L4G Progress developper and I just use TELERIK Objets in my programs like the RadGridview.
    And I can't format my decimal columns in a RadGridView.
    Decimalplaces propriety has no effect and all tested values like "{0:C}" or "{###.##}" for the formatstring propriety are not allowed.
    May be I miss some classes which allows these values ????
    I'm sorry but I'm a beginner with .Net developpement.

    Thanks a lot for your answers.

    JP CLARY

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3759 posts

    Posted 28 Dec 2018 Link to this post

    Hello, Jean-Pierre, 

    You can define how many places after the decimal point the value in the spin editor should have by setting the DecimalPlaces property of GridViewDecimalColumn. In order to define how the values should be displayed by the cells of the GridViewDecimalColumn while the cell is not being edited in the sense of their decimal places, we should set the FormatString property of the column.

    GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn();
    decimalColumn.Name = "DecimalColumn";
    decimalColumn.HeaderText = "Unit Price";
    decimalColumn.FieldName = "UnitPrice";
    decimalColumn.DecimalPlaces = 3;
    decimalColumn.FormatString = "{0:C}";
    radGridView1.MasterTemplate.Columns.Add(decimalColumn);
     
    for (int i = 0; i < 10; i++)
    {
        this.radGridView1.Rows.Add(i*0.25);
    }



    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    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