Showing posts with label Remove Comma and Decimal point from decimal Type data in asp.net mvc5. Show all posts
Showing posts with label Remove Comma and Decimal point from decimal Type data in asp.net mvc5. Show all posts

Thursday, March 20, 2014

How To Remove Comma and Decimal point from decimal Type data in asp.net mvc5

To Remove comma and decimal point of decimal type property

For Example:
We want to get Value  54321    Instead of  54321.00 

Just Use The Attribute in The model class:

[DisplayFormat(DataFormatString = "{0}")]

e.g.
 public class Mn{

        [DisplayFormat(DataFormatString = "{0}")]

         public decimal NoOfInstallments{ get; set; }

}


And Also Use(carefully):

 TextBoxFor() Instead of  EditFor()

e.g.

 @Html.TextBoxFor(model => model.NoOfInstallments)

For Example:
To Get Value  54321    Instead of  54321.00