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

Form textbox field with no decimals

1 Answer 11 Views
Form
This is a migrated thread and some comments may be shown as answers.
Frans
Top achievements
Rank 1
Veteran
Iron
Frans asked on 15 Apr 2021, 02:04 PM

Hi,

How can I get a textbox in the form fields with 0 decimals ?

There are always 2 decimals now.

Is teher a simple way to do it ? Preferably serverside.

 

Martin

 

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 20 Apr 2021, 11:54 AM

Hello, Martin,

if you wish to have no trailing zeros in the input field, you can use the Format configuration of the NumericTextBox:

@(Html.Kendo().Form<FormDemoMVC.Models.FormViewModel>()
        .Name("exampleForm")
        .Items(items =>
        {
            items.AddGroup()
                .Label("Registration Form")
                .Items(i =>
                {
                    i.Add()
                        .Field(f => f.NumericTextBox)
                        .Label(l => l.Text("NumericTextBox:"))
                        .Editor(e =>
                        {
                            e.NumericTextBox().Format("#0");
                        });                    

                });
        })
    )

Let me know if that is what you are looking for.

Regards,
Martin
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Tags
Form
Asked by
Frans
Top achievements
Rank 1
Veteran
Iron
Answers by
Martin
Telerik team
Share this question
or