Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > NumericTextBox > International Brazillian Portuguese Currency Input Validation Error

Not answered International Brazillian Portuguese Currency Input Validation Error

Feed from this thread
  • Maicon avatar

    Posted on Feb 16, 2012 (permalink)

    Hello all, I just started using Telerik MVC tools, and I found a problem with CurrencyTextBox I cant solve:

    My Model has a field: 
    ...
    [Required]
    [Display(Name = "Valor")]
    [DataType(DataType.Currency)]
    public decimal Valor { get; set; }
    ...

    And I use it in a form (razor):
    ...
    <td>
        @Html.LabelFor(m => m.Valor)
    </td>
    <td>
        @Html.EditorFor(m => m.Valor)
        <span class="error">@Html.ValidationMessageFor(x => x.Valor)</span>
    </td>
    ...

    But since it is a portuguese/Brazil site, and work with Real (BRL), I changed the Currency.cshtml to:
    @model decimal
     
    @(Html.Telerik().CurrencyTextBox()
            .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
            .InputHtmlAttributes(new {style="width:100%"})
            .MinValue(0)
            .Value(Model)
            .CurrencySymbol("R$")
            .DecimalDigits(2)
            .DecimalSeparator(",")
            .NumberGroupSeparator(".")
            .Spinners(false)
    )

    The problem is the form format my currency ok, but always accuse the value as "not a number" since in pt_BR the comma and point are inverted R$ 10.000,00

    R$ 3.671,94
     
    The field Valor must be a number.



    How can I solve this? I have lots of currency fields all over my forms.

    Reply

  • Maicon avatar

    Posted on Feb 28, 2012 (permalink)

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > NumericTextBox > International Brazillian Portuguese Currency Input Validation Error
Related resources for "International Brazillian Portuguese Currency Input Validation Error"

ASP.NET MVC NumericTextBox Features  |  Documentation  |  Demos  |  Telerik TV ]