MVC NumericTexbox min/max validation message not showed

3 posts, 1 answers
  1. Leonard
    Leonard avatar
    2 posts
    Member since:
    Dec 2015

    Posted 28 Feb 2016 Link to this post

    I defened in my model a range for my field:

    public int? SpringA1 {get;set;}

    I have a grid with a template editor with my field :

    @Html.kendo().IntergerTexBoxFor(model => model.SpringA1)

    My problem is when I enter a value out of range the control change the value to min or max range instead of showing a range error message.

    ex : if You enter a value of 3000 with the keyboard and lose focus from the input or save the form, the value will be rounded to the max value of 2043.


    If I init de Deferred property to true

    @Html.kendo().IntergerTexBoxFor(model => model.SpringA1).Deferred(true)

    the message is correctly showed but the control is not rendered properly, no css and no span for increment the value.


    what I can do for prevent the control to round the value and show the message.










  2. Answer
    Georgi Krustev
    Georgi Krustev avatar
    3747 posts

    Posted 02 Mar 2016 Link to this post

    Hello Leonard,

    The MVC NumericTextBox extension is designed to retrieve min/max range from the the Model property metadata. When the Model property is decorated with Range attribute, the widget will retrieve the range values and will set its min/max options.

    If you would like to avoid this behavior, then you will need to remove the defined min/max options manually:
    @Html.kendo().IntergerTexBoxFor(model => model.SpringA1).Min(null).Max(null)

    Georgi Krustev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Leonard
    Leonard avatar
    2 posts
    Member since:
    Dec 2015

    Posted 02 Mar 2016 in reply to Georgi Krustev Link to this post

    Thank you, works like i expected.
Back to Top