1

Example Value 2.546400000 I want 2.546400

[DisplayFormat(DataFormatString = "{0:n}")]
public decimal? TrackingErrorHigh { get; set; }
DavidG
  • 113,891
  • 12
  • 217
  • 223
  • It's really unclear what you're asking here. Where are you displaying the data? Is this an ASP.NET MVC view? – DavidG Sep 18 '20 at 08:47
  • Here, I want to Display 6 digits for decimal number – Chenchu babu Sep 18 '20 at 08:49
  • https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.boundfield.dataformatstring?view=netframework-4.8 – Nsevens Sep 18 '20 at 08:51
  • Does this answer your question? [c# - Show a decimal to 6 decimal places](https://stackoverflow.com/questions/8412882/c-sharp-show-a-decimal-to-6-decimal-places) – Drag and Drop Sep 18 '20 at 08:56
  • I think there is a already around ~5 questions from displaying decimal for each possible number of digits. – Drag and Drop Sep 18 '20 at 08:59

2 Answers2

1
[DisplayFormat(DataFormatString="{0:N6}")]
public decimal? TrackingErrorHigh { get; set; }

or custom formatting

[DisplayFormat(DataFormatString="{0:############.000000}")]
public decimal? TrackingErrorHigh { get; set; }
Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72
0

Details can be found here - taken from there:

To Displays numeric values in number format (including group separators and optional negative sign). You can specify the number of decimal places. You use {0:N}

[DisplayFormat(DataFormatString="{0:N6}")]
public decimal? TrackingErrorHigh { get; set; }
Postlagerkarte
  • 6,600
  • 5
  • 33
  • 52