I have this as Model:
[code]
[Required]
public Decimal MondayHours { get; set; }
[/code]
and this in the view:
[code]
@Html.Label("Maandag")
@string.Format("{00:###:#}", Model.Monday)
@Html.TextBox("Monday", Model.Monday.ToString(), new{@readonly = "readonly" })
@Html.ValidationMessageFor(model=> model.Monday)
[/code]
but I put for example an number: 7.5 that the number will be saved as:75,00. and not as: 7,5.
THX for helping!!
VulpesPosted Jun 8, 2012, 5:43 AM
albert albertPosted Jun 8, 2012, 6:01 AM
So glad u helped me.
albert albertPosted Jun 8, 2012, 5:39 AM
albert albertPosted Jun 8, 2012, 5:36 AM
albert albertPosted Jun 8, 2012, 5:34 AM
[code]
[code]
And in global.asax.cs:
[code]
Because then I can save it like this: 7.5 instead of: 7,5.
and then the class:
[code]
but is still save as: 75,00 instead of: 7,5
VulpesPosted Jun 8, 2012, 5:25 AM
albert albertPosted Jun 8, 2012, 5:19 AM
[code]
@Html.Label("Maandag")
@string.Format("{0:0.##}", Model.Monday)
@Html.TextBox("Monday", Model.Monday.ToString(), new{@readonly = "readonly" })
@Html.ValidationMessageFor(model=> model.Monday)
[/code]
And when I create a new hour in the textbox standard value of this: 0,00. and then I change it to: 7.5 and press create. But then I see in the Index page that the value has changed to: 75,00.
albert albertPosted Jun 8, 2012, 5:15 AM
[code]
albert albertPosted Jun 8, 2012, 5:08 AM
Thx for the replay.
But it doesnt work :(
I have it now like this:
[code]
[Required]
//[DisplayFormat(DataFormatString= "{0:#,##0.000#}")]
public Decimal MondayHours { get; set; }
[/code]
and for the view:
[code]
@Html.Label("Maandag")
@string.Format("{0:0.00}", Model.Monday)
@Html.TextBox("Monday", Model.Monday.ToString(), new{@readonly = "readonly" })
@Html.ValidationMessageFor(model=> model.Monday)
[/code]
And in the databse the property is a numeric.
The value is still: 75,00 instead of: 7,5
Sorry I mean this:
[code]
Nattudurai EswaramurthyPosted Jun 8, 2012, 4:59 AM