This is a migrated thread and some comments may be shown as answers.

[Solved] Percentage Textbox problem

1 Answer 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jfhandfield
Top achievements
Rank 1
jfhandfield asked on 23 Feb 2011, 04:30 AM
Hello everyone,

I have a small problem Html.Telerik().PercentTextBox(). When I pull the value out of my DB it's says 10.5... Don't ask why there is a .5 the client wants it that way. But when I stick it in the PercentageTextBox I get 105% instead of 10.5%

Is there a way to fix that??

Thank you

1 Answer, 1 is accepted

Sort by
0
Marino
Top achievements
Rank 1
answered on 23 Sep 2011, 12:04 PM
Hi jfhandfield,

I got the same error like you. I could pinpoint the problem to the CultureInfo that I am using. If I use "en-US" on my Thread.CurrentThread.CurrentCulture then everything's okay.But I am using another CultureInfo ("nl-NL", with good reasons) and then everything's bogus. 

It looks like some javascript cannot handle any other DecimalSeparator than a dot ('.') while I want a comma (',') instead.

Here's the code to reproduce the problem. I am using the Telerik MVC extension controls version 2011.2.712.
<% Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-NL"); %> 
<%= Html.Telerik().PercentTextBox()
        .Name("MyPercentage")
        .Spinners(false)
        .DecimalDigits(2)
        .DecimalSeparator(",")
        .NumberGroupSeparator(".")
        .MinValue(0)
        .MaxValue(100)
        .Value(48.8366) %>

I hope that someone knows a solution or work-around for this.

Thanks,
Marino.
Tags
Grid
Asked by
jfhandfield
Top achievements
Rank 1
Answers by
Marino
Top achievements
Rank 1
Share this question
or