SfDataGrid GridValues and Summary column

I am taking taking values to the Datagrid through a Stroe Procedure and mu autogenratecolumns is true.
[1st case]
The problem I am facing is in my cell, even though I have 4 decimal places in the data it is only showing upto 2. 

[2nd case]
To change 2 to a fixed number of decimals I convetred the property to nvarchar in Stored Procedure.
It worked well. But then in my summary column i  loses the way of sum(I Think sum won't take the values in strings).


Firstly the datagrid itself rounding the value to two decimal.Second if i change the property to string I'm losing the summary vlaue.

Hope the question is clear. Thanks. 

3 Replies

DY Deivaselvan Y Syncfusion Team September 19, 2018 01:09 PM UTC

Hi Mohammed,

Thank you for contacting Syncfusion support.

SfDataGrid will display the numeric value with two decimal points by default in loading. You can meet your requirement by setting the NumberDecimalDigits to the required NumericColumn in the AutoGeneratingColumn event of SfDataGrid control. Please refer the below code example for the same. 
datagrid.AutoGeneratingColumn += dataGrid_AutoGeneratingColum;

void dataGrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e) 
 
    if (e.Column.MappingName == "UnitPrice") 
   
        if (e.Column is GridNumericColumn) 
                      (e.Column as GridNumericColumn). NumberDecimalDigits= 4; 
   

https://help.syncfusion.com/wpf/sfdatagrid/column-types#data-formatting-1

Please let us know if you have any other questions.

Regards,
Deivaselvan 



MO MOHAMMED September 20, 2018 06:19 AM UTC

Exactly what I was searching for . Thanks a lot Deivaselvan Y


DY Deivaselvan Y Syncfusion Team September 20, 2018 06:46 AM UTC

Hi Mohammed,

We are happy to hear that the given solution meets your requirement. Please let us know if you require any further assistance.

Regards,
Deivaselvan
 


Loader.
Up arrow icon