Gow to set for for NumericTextBox dynamically?

1 Answer 15 Views
General Discussions NumericTextBox
Vivek
Top achievements
Rank 1
Iron
Vivek asked on 06 Jun 2022, 02:35 PM

how to set NumericTextBox format dynamically like below. I tried this but its not working.


var dynamicValue = "###,###.000";

@(Html.Kendo().NumericTextBox<double>()
	.Name("Amount")
	.Spinners(false).Format("dynamicValue")
	.Decimals(3)
	.HtmlAttributes(new { style = "width: 100%; height: 27px;", tabindex = "6" })
	.Events(e => e.Change("OnAmountChange"))
)

dynamicValue is set as the response of GET API call.

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 09 Jun 2022, 10:51 AM

Hi Vivek,

Thank you for the image and details provided.

In order to achieve the desired behavior, I would recommend using the "setOptions" method. The following dojo example is representing a similar approach:

The following forum thread answer is demonstrating the syntax needed:

The approach above is providing the opportunity to set a new format for the NumericTextBox dynamically with JavaScript.

I hope this information helps. Let me know if further assistance or information is needed.

Kind Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions NumericTextBox
Asked by
Vivek
Top achievements
Rank 1
Iron
Answers by
Anton Mironov
Telerik team
Share this question
or