Category: How do I do X?

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Format table column for Currency


I have a table in my mysql database with decimal fields set as (19,2). When I run a query, it returns numbers formatted as expected with 0.00, but in asppsmith, it returns numbers without respecting the format. How can I format the table column to always show 2 decimal places?


The solution to formatting a table column to always show 2 decimal places in ASP.NET is to set the computed value using the toFixed() method in the column settings. This can be done by going to the column settings and selecting "Computed value" as the source and entering the formula using toFixed(), such as "toFixed(2)" for two decimal places. This will ensure that the numbers are always displayed with two decimal places, even when querying the database. The toFixed() method can also take a parameter for the number of decimal places, such as "toFixed(3)" for three decimal places. This solution is easy to implement and ensures consistent formatting of decimal numbers in the table.