I am a newbie to .NET. I cannot figure out the correct syntax to show three decimal places in my view.
In my model I currently have:
<<Display(name:="Straight Rate")>
Public Property StraighRate() As Decimal
Get
Return mStraightRate
End Get
Set(ByVal value As Decimal)
mStraightRate = value
End Set
End Property
I know I need to use the DisplayFormat in my model, but I cannot figure out the syntax that will make it work.
Do I need to do anything additional in my View after I add the syntax for the DisplayFormat in my model?
Here is what I have in my current view:
@Html.DisplayFor(Function(modelItem) currentItem.StraightRate)
Use the DisplayFormatAttribute
. The DataFormatString
property determines how the value is displayed in a DisplayTemplate
<Display(name:="Straight Rate")>
<DisplayFormat(DataFormatString:="{0:0.000}")>
Public Property StraighRate() As Decimal