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

Formatstring values problem

1 Answer 279 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jean-Pierre
Top achievements
Rank 1
Jean-Pierre asked on 28 Dec 2018, 09:13 AM
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

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Dec 2018, 09:36 AM
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.
Tags
GridView
Asked by
Jean-Pierre
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or