Convert decimal as string to decimal for grid

I have a grid im populating with values in  decimal but loaded in the collection as strings.   Can i convert column fields into decimal in realtime  or should i convert them to decimal in the collection?

Example below fails becuase  BaseAmount is a string but would like to parse as a decimal so the SUM agrega

                    <GridAggregates>

                        <GridAggregate>

                            <GridAggregateColumns>

                                <GridAggregateColumn Field="@nameof(TradeResponse.BaseAmount)" Type="AggregateType.Sum" Format="C2">

                                    <FooterTemplate>

                                        @{

                                            var SumValue = (context as AggregateTemplateContext);

                                            <div>

                                                Count: @SumValue.Sum

                                            </div>

                                        }

                                    </FooterTemplate>

                                </GridAggregateColumn>

                            </GridAggregateColumns>

                        </GridAggregate>

                    </GridAggregates>


3 Replies 1 reply marked as answer

NP Naveen Palanivel Syncfusion Team June 1, 2022 05:53 PM UTC

Hi Anthony,


Greetings from Syncfusion support.


We analysed your query and we understand that you have defined the decimal value in form of string. We would like to inform you that only numerical values will be calculated and displayed in aggregate without error. So we suggest you to convert string values to decimal value in your collection and assign it to Grid datasource.


Please let us know if you have any concerns


Regards,

Naveen Palanivel.


Marked as answer

AN Anthony replied to Naveen Palanivel June 2, 2022 11:14 AM UTC

thank you



NP Naveen Palanivel Syncfusion Team June 3, 2022 01:52 PM UTC

Hi Antony,


Welcome


we suspect that the reported issue has been resolved


Please get back to us if you need further assistance.


Regards,

Naveen Palanivel.


Loader.
Up arrow icon