NumericTextBox with null values

3 posts, 0 answers
  1. Tomasz
    Tomasz avatar
    9 posts
    Member since:
    Oct 2012

    Posted 17 Jan 2013 Link to this post

    I have a Model which contains a property
    public decimal? CountedStockQuantity {get;set;}

    I bind this property to grid column like this:
    columns.Bound(col => col.CountedStockQuantity).EditorTemplateName("FixedNullableDecimal").Width(120).ClientTemplate("#= (CountedStockQuantity == null) ? ' ' : CountedStockQuantity #");

    I use a editor template :
    @model  decimal?
                
     @(Html.Kendo().NumericTextBoxFor(m => m)
          .HtmlAttributes(new { style = "width:100%" })
          ) 

    When I leave an empty value in control, validation occur
    The field Counted qty. must be a number.

    How do I need to build an template editor to avoid this validation ?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 21 Jan 2013 Link to this post

    Hello Tomasz,

    Are you sure that you have not added the [Required] datatype attribute? I am not able to reproduce such behavior on my side. Please check the attached project and modify and send back if I missed something.


    Kind regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Tomasz
    Tomasz avatar
    9 posts
    Member since:
    Oct 2012

    Posted 22 Jan 2013 Link to this post

    I upgrade my Kendo version to the latest release and it seems to work fine.
    Thanks
Back to Top