I try to use the NumericTextBox in combination with data annotations in MVC 5.
Kendo UI v2014.2.716
Windows 7 64 bit
Internet Explorer 10.0.9200.17089
jQuery 1.9.0
I have a class with a DisplayFormat attribute on a property:
In the view, I generate a NumericTextBox for that property:
Whtat I would like, is that the NumericTextBox behaved as if I wrote this:
Writing .Format("N3") on every line where I use said property is undesirable. I would like to manage the formatting using (custom) data annotations.
If I use @Html.EditorFor, then the values in the generated textbox are formatted the way I like.
How can I achieve this with the Kendo NumericTextBox?
Kendo UI v2014.2.716
Windows 7 64 bit
Internet Explorer 10.0.9200.17089
jQuery 1.9.0
I have a class with a DisplayFormat attribute on a property:
public
class
EnkelOppervlakteRow
{
public
int
FosfaattoestandId {
get
;
set
; }
public
string
Omschrijving {
get
;
set
; }
[DisplayFormat(DataFormatString=
"{0:n3}"
, ApplyFormatInEditMode=
true
)]
public
decimal
Oppervlakte {
get
;
set
; }
public
int
? Id {
get
;
set
; }
}
In the view, I generate a NumericTextBox for that property:
@(Html.Kendo().NumericTextBoxFor(mdl => mdl.Oppervlakte))
Whtat I would like, is that the NumericTextBox behaved as if I wrote this:
@(Html.Kendo().NumericTextBoxFor(mdl => mdl.Oppervlakte)
.Format(
"N3"
)
)
Writing .Format("N3") on every line where I use said property is undesirable. I would like to manage the formatting using (custom) data annotations.
If I use @Html.EditorFor, then the values in the generated textbox are formatted the way I like.
How can I achieve this with the Kendo NumericTextBox?