Cassie Mod

Cassie Mod

  • NA
  • 488
  • 71.2k

how to set a decimal value to kendo numerictextboxfor

Nov 14 2017 6:11 AM
HI,
 
ive got the following question.
I have a kendo  Numerictextbox. however the value is only set when it is an int. when it is a double is doesn't fill the numerictextbox, because he doesn't know what to do with the value after the. so it leaves it completely empty.
 
However how can i get this working? becuase it does need to set a decimal ( price of products). Eventually i need to set the value of m.UnitPrice in the numerictextbox. 
 
here is my code.:
  1. <div class="form-group">  
  2.                 @Html.LabelFor(model => model.UnitPrice, new { @class = "col-lg-3 col-md-3 col-sm-3 col-xs-3 control-label" })  
  3.                 <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">  
  4.                     @(Html.Kendo().NumericTextBoxFor<decimal>(m => m.UnitPrice)  
  5.                           .HtmlAttributes(new {@class = "k-numerictextbox"})  
  6.                           .HtmlAttributes(new {style = "width:100%"})  
  7.                           .Min(-999999)  
  8.                           .Max(999999)  
  9.                           .Decimals(2)  
  10.                           .Value(12.3M)  
  11.                           )  
  12.                     @*@(Html.EditorFor(m => m.UnitPrice))*@  
  13.                     @Html.ValidationMessageFor(m => m.UnitPrice, ""new {@class = "text-danger"})  
  14.                 </div>  
  15.                 <div class="form-control-static col-lg-5 col-md-5 col-sm-5 col-xs-5">  
  16.                     per maand  
  17.                 </div>  
  18.             </div>