I am using MVC 4. I've got an MVC Form two fields AmtInDollars & AmtInCents. I want to concatenate the two. Eg
var tempDollarAmt = AmtInDollars + "" + AmtInCents;
Example
Input: 100 in dollars
Input: 00 in cents
Output: 1000 // missing 1 zero due to input being 00.
Desired Output: 10000.
I realized that if the AmtInCents is between 0 and 9 it ingnores the 0. So if I type 09 the output is 9 not 09.
I have tried doing an if statement below and still no luck.
if(Products.AmtInCents < 10)
{
var tempCents = 0;
Products.AmtInCents = 00;
}
Here my class
public decimal? AmtInDollars { get; set; }
public decimal? AmtInCents { get; set; }
How can I do this?