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 8383805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:15:25+00:00 2026-06-09T17:15:25+00:00

I have this decimal set up: [Required(ErrorMessage = Please tell us your income)] [Display(Name

  • 0

I have this decimal set up:

[Required(ErrorMessage = "Please tell us your income")]
[Display(Name = "How much do you earn from all the income types you selected above?")]
[DataType(DataType.Currency)]
[DisplayFormat(DataFormatString = "{0:c}")]
public decimal IndivdualIncome { get; set; }

I am using [Serializable] on my Model. Using a ViewModel to bring this in to my view. Also using a multi-step wizard.

When I get to a step with this type of input (for capturing decimal values), the text box is empty and I can enter “1000”. This is expected behavior. However, say I click “Next” on the wizard and the next step has a similar text box (again, it’s blank which is expected – call it “SpouseIncome”), but then if I do not enter any value and:

  1. I hit “Back”, then the “IndividualIncome” textbox will display the value as “1000.00”; and
  2. If I then hit “Next”, the “SpouseIncome” (which I left blank) now shows “0.00”.

Is it my use of decimal, or possibly the attributes I am using?

Any help on how I can just have it display as either blank (no “0.00”) or to take out the “.00” if a value was input previously is much appreciated.

  • 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-06-09T17:15:27+00:00Added an answer on June 9, 2026 at 5:15 pm

    You probably want to use "{0:N}" which is number format or "{0:g}", which is general number format instead currency format "{0:c}" you currently using.

    Or you might want to consider custom number formatting to be very specific on what you looking for.
    Something like this {0:0,0}, which is thousand separator, gives you 1,500.

    More about string formats and custom number formatting here.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this in my view model: [Required(ErrorMessage = Price is required)] [Range(0.01, 999999999,
I have the following POCO's: [PetaPoco.TableName(Customer)] [PetaPoco.PrimaryKey(ID)] public class User { [Required(ErrorMessage = Please
I have this regex working but now need to allow numbers without the decimal
IF i have the following: MyString.ValueType = typeof(System.Decimal); how can i make this have
In order to work with decimal data types, I have to do this with
This seems to have been asked before: rails decimal precision and scale But when
I have a table with two decimal(18,0) fields. I am inserting into this table,
Hi I have a property in one of my models which is: [Required(ErrorMessage =
In this query I have 3 records (int-(telefon = d.telefon), decimal-(pesel = d.pesel), decimal-(nip
I have a property like so public decimal? MyProperty { get; set; } ,

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.