Kendo ui Numerictextboxfor - Set startup values

Asked

Viewed 27 times

2

How can I set a default startup value for the field Numerictextboxfor kendo’s.

Ex: My field is empty initialized. I want it to come with a default set by me:

@(Html.Kendo().NumericTextBoxFor(model => model.MinVoltage).Name("MinVoltage").HtmlAttributes(new { style = "width: 6em;font-size:12px;font-weight:normal" }))
@Html.ValidationMessageFor(model => model.MinVoltage)

My model is like this:

    [Column("MIN_VOLTAGE")]
    [Required(ErrorMessage = "Campo obrigatório")]
    [Display(ResourceType = typeof(Messages), Name = "MinimuVoltage")]
    [Range(0.1, 99.99, ErrorMessage = "Valores válidos: 0.1 a 99.99 ")]
    public double MinVoltage { get; set; }

inserir a descrição da imagem aqui

I set a Range value, and I want it to start by default at 0.1, But the field is initialized with no default value as shown above.

How can I set a default startup value for the field Numerictextboxfor?

1 answer

0

Use . Value(0.1) to set default value.

For the range use . Min(0.1) and . Max(99.99)

To configure the increment use . Step(0.1)

you may need to configure the format . Format() and if you cannot with Numerictextboxformodel use . Numerictextbox()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.