Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6943711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:11:30+00:00 2026-05-27T13:11:30+00:00

I am storing Amount in Decimal(18,2). But most of my data is actually integer

  • 0

I am storing Amount in Decimal(18,2). But most of my data is actually integer with only few decimal. So when I display the amount for each item in the table, the number display is all 3.00, 4.00, 5.00 and so on.

I feel it is kind of weird to display all the 0 as the decimal point. I wish to format the number when display if the decimal point is 0.

Currently I am displaying the amount like this:

  <td id="amnt@(item.FoodID)" class="amountfield">
      @Html.DisplayFor(modelItem => item.FoodAmount)
  </td>

Any idea?? Appreciate every help… thanks…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:11:31+00:00Added an answer on May 27, 2026 at 1:11 pm

    Looking at your code I assume that you are using ASP.Net MVC for your application. You can use DataAnnotation for formatting your data.

    You can try using DisplayFormat in your model property.

    [DisplayFormat(DataFormatString = "{0:0.##}")] 
    Decimal FoodAmount{ get; set; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know what is the best solution for storing large amount
How could i multiply a string by a number to achieve n amount of
i want to show only two decimal places in my edit text, ofc i
var total = 0; $(.amount).each(function () { var value = $(this).val(); value = (value.length
My form contains several NumericUpDown controls. These controls show different amount of decimal places.
i think both are same,but i found use of them in only one file
I have an input field for users to input a monetary amount: <input type="number"
The code below works fine but, in the textbox the decimal value has this
I'm trying to convert and exponential number 1.11111117E+9 which is actually a 10 digit
I'm storing 0.00 decimal values as text in an SQLiteDB. I'm retrieving them by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.