We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to remove trailing 0 in decimal.

Hi Team,

Is there is anyway to remove the trailing 0 in decimal in the grid column. It seems "Format" is limited on this. Could we apply formatstring on this?


for example 120.0000  = 120, 120.1010 = 120.101, 120.50 = 120.5


Hoping for you answer,


Best regards


Tyrone


2 Replies

NP Naveen Palanivel Syncfusion Team January 9, 2023 05:41 PM UTC

Hi Tyrone,


Thank you for reaching out to Syncfusion support.


You can use the formatting options in the grid column to remove any trailing zeros after the decimal point. For example, you can use the format "0.#####" to remove these zeros. Please see the attached code snippet and screenshot for reference.


<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>

        <GridColumn Field=@nameof(Order.OrderDate) HeaderText="Order Date" Visible="false" Format="d" TextAlign="TextAlign.Right" Width="130" Type="ColumnType.Date"></GridColumn>

        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="0.#####"  TextAlign="TextAlign.Right" Width="120">




Please let us know if you have any concerns.


Regards,

Naveen Palanivel



TY Tyrone January 19, 2023 12:42 PM UTC

Thanks Naveen, it worked..


Loader.
Up arrow icon