1

Example Value 2.546400000 I want 2.546400

[DisplayFormat(DataFormatString = "{0:n}")]
public decimal? TrackingErrorHigh { get; set; }
DavidG
  • 104,599
  • 10
  • 205
  • 202
  • 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://docs.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
  • 26,360
  • 3
  • 47
  • 64
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
  • 5,856
  • 5
  • 29
  • 49