We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

unable to get value in Postback with NumberTextBoxfor and Locale

Hi

I'm started working with syncfusion and thinks is amazing. But recently with version v.12.4.0.24I got an strange issue with NumericTextBoxFor.
When I set to use Locale ("es-AR") or Locale ("es-ES"), you can enter a value, and then click on submit button, the value is 0.

For instance.
<div class="row">
                    <div class="col-md-3">
                        @Html.LabelFor(model => model.ExchangeRate, htmlAttributes: new { @class = "control-label" })
                        @Html.EJ().NumericTextBoxFor(model => model.ExchangeRate).Locale("es-AR").ShowSpinButton(false).DecimalPlaces(2)
                        @Html.ValidationMessageFor(model => model.ExchangeRate)
                    </div>
</div>

But when I not using the locale parameter, I can get the value.

<div class="row">
                    <div class="col-md-3">
                        @Html.LabelFor(model => model.ExchangeRate, htmlAttributes: new { @class = "control-label" })
                        @Html.EJ().NumericTextBoxFor(model => model.ExchangeRate).ShowSpinButton(false).DecimalPlaces(2)
                        @Html.ValidationMessageFor(model => model.ExchangeRate)
                    </div>
</div>

This is are the script I´m using in _layout.
 <script src="@Url.Content("~/Scripts/jquery.globalize.min.js")"></script>
<script src="@Url.Content("~/Scripts/cultures/globalize.culture.es-AR.js")"></script>



Regards
Adrian



1 Reply

KS Kaliswaran Shanmuga Sundaram Syncfusion Team March 2, 2015 09:57 AM UTC

Hi Adrian,

Thanks for using Syncfusion product.

Query: “In NumericTextboxFor When I set to use Locale ("es-AR") or Locale ("es-ES"), you can enter a value, and then click on submit button, the value is 0. But when I not using the locale parameter, I can get the value.

We would like to let you know that, in “For” controls while unobtrusive is in enabled state we should give the properties in the view model as shown in the following code snippet.

[Controller]

public ActionResult Index()

        {

            Incident inc =new Incident();

            EditorProperties editor = new EditorProperties();

            editor.ShowSpinButton = false;

            editor.DecimalPlaces = 2;

            editor.Locale = "es-AR";

            ViewData["editmodel"] = editor;

            return View(inc);

        }

We can access the For controls properties by defining it in the view model. If we set unobtrusive is false, then we can access all the properties directly in the builder itself. Please refer the following code snippet to know how to use For control properties when the unobtrusive is set to false.

[cshtml]

@Html.EJ().NumericTextBoxFor(model => model.ExchangeRate).ShowSpinButton(false).DecimalPlaces(2).Locale("es-AR")

 

For your convenience we have prepared a simple sample based on your requirement and the same can be downloaded from the following location.

Sample Location: Sample

Please let us know if you have further concern.

Regards,

Kaliswaran S


Loader.
Live Chat Icon For mobile
Up arrow icon