asp.net mvc - Kendo UI NumericTextBox percentage format -


my problem similar explained in question: kendonumerictextbox percentage formatting

but i'm using asp.net mvc wrappers render numerictextbox.

i have following editor template render widget:

@model double? @(html.kendo().numerictextboxfor<double>(m => m) .format("{0:p2}") .min(0) .max(1) .step(0.01) ) 

but happening (examples):

  • value show when widget focused: 0.01 -> value show when widget not focused: 10,00%
  • value show when widget focused: 0.63 -> value show when widget not focused: 63,00%
  • value show when widget focused: 0,6345 -> value show when widget not focused: 63,00%
  • value show when widget focused: 5 -> value show when widget not focused: 100,00%

what somethinh this:

  • value show when widget focused: 10 -> value show when widget not focused: 10,00%
  • value show when widget focused: 63 -> value show when widget not focused: 63,00%
  • value show when widget focused: 63,45 -> value show when widget not focused: 63,45%

but in database need store value between 0 , 1. reason have ....min(0).max(1)...

how achieve using mvc wrapper?

the solution came was:

@(html.kendo().numerictextboxfor<double>(m => m)     .format("##.00 \\%")     .min(0)     .step(1)     .decimals(2) ) 

after, in controller, convert [0,1].


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -