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!!

VulpesRank #55 · 29.2K reputationPosted Jun 8, 2012, 1:43 AM EDT
Nattudurai EswaramurthyRank #5,536 · 296 reputationPosted Jun 8, 2012, 12:59 AM EDT
albert albertRank #2,683 · 519 reputationPosted Jun 8, 2012, 1:08 AM EDT
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]
albert albertRank #2,683 · 519 reputationPosted Jun 8, 2012, 1:15 AM EDT
[code]
albert albertRank #2,683 · 519 reputationPosted Jun 8, 2012, 1:19 AM EDT
[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.
VulpesRank #55 · 29.2K reputationPosted Jun 8, 2012, 1:25 AM EDT
albert albertRank #2,683 · 519 reputationPosted Jun 8, 2012, 1:34 AM EDT
[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
albert albertRank #2,683 · 519 reputationPosted Jun 8, 2012, 1:36 AM EDT
albert albertRank #2,683 · 519 reputationPosted Jun 8, 2012, 1:39 AM EDT
albert albertRank #2,683 · 519 reputationPosted Jun 8, 2012, 2:01 AM EDT
So glad u helped me.