I have a Kendo NumericTextBox. This text box allows positive and negative numbers.
As expected, negative numbers have a '-' prefix.
Is it possible to prefix a '+' on positive numbers?
I'm using ASP.NET MVC 5. Here's a code sample:
@Html.Kendo().NumericTextBoxFor(model => model.PositveNegative).Step(0.25f)
Any help with this would be greatly appreciated.
Thanks.
Abrar
Using Mr Cocococo's answer as a starting point here is the MVC wrapper version for you:
@(Html.Kendo().NumericTextBox().Name("Test").Step(0.25f)
.Events(events => events.Change("Testing").Spin("Testing"))
)
<script>
function Testing()
{
var numeric = $("#Test").val();
if (numeric > 0)
{
$("#Test").kendoNumericTextBox({ format: "+##.##", decimals: 2 });
}
else
{
$("#Test").kendoNumericTextBox({ format: "##.##", decimals: 2 });
}
console.log(numeric);
}
</script>
This works with either typing or using the spinners and should give you the desired results.