I have a decimal field DocNum and a nullable integer field RelatedDocNum
I've created an EditorFor template called Decimal.cshtml:
@model
decimal
?
@(Html.Kendo().NumericTextBoxFor(m => m).HtmlAttributes(
new
{ @
class
=
"form-control"
}).Decimals(2))
and an EditorFor template called Integer.cshtml:
@model
int
?
@(Html.Kendo().IntegerTextBoxFor(m => m).HtmlAttributes(
new
{ @
class
=
"form-control"
}).Min(
int
.MinValue).Max(
int
.MaxValue))
When I use it in my view, like this:
@Html.EditorFor(m => m.DocNum)
and
@Html.EditorFor(m => m.RelatedDocNum)
DocNum renders correctly, but RelatedDocNum does not. The class form-control does not get applied to RelatedDocNum. See screenshot.
I do not have any Kendo or jQuery errors on the page. The page source looks like this:
<div
class
=
"col-md-4"
>
<label
class
=
"control-label"
for
=
"DocNum"
>Document Number</label>
<input
class
=
"form-control"
data-val=
"true"
data-val-number=
"The field Document Number must be a number."
data-val-required=
"The Document Number field is required."
id=
"DocNum"
name=
"DocNum"
type=
"text"
value=
"5227.00"
/>
<script>
kendo.syncReady(function(){jQuery(
"#DocNum"
).kendoNumericTextBox({
"decimals"
:2});});
</script>
<span
class
=
"field-validation-valid text-danger"
data-valmsg-
for
=
"DocNum"
data-valmsg-replace=
"true"
></span>
</div>
<div
class
=
"col-md-4"
>
<label
class
=
"control-label"
for
=
"RelatedDocNum"
>Related Document Number</label>
<input
class
=
"text-box single-line"
data-val=
"true"
data-val-number=
"The field Related Document Number must be a number."
id=
"RelatedDocNum"
name=
"RelatedDocNum"
type=
"number"
value=
""
/>
<span
class
=
"field-validation-valid text-danger"
data-valmsg-
for
=
"RelatedDocNum"
data-valmsg-replace=
"true"
></span>
</div>
What am I missing?
TIA!