Nullable Datepicker

2 posts, 0 answers
  1. Nga
    Nga avatar
    8 posts
    Member since:
    Oct 2012

    Posted 21 Feb 2013 Link to this post


    I have editable grid which opens a popup when editing, this is opening a template page.

    In this template page I have a kendo datepicker

    <div class="editor-label">
        @Html.LabelFor(model => model.DateInvoiced)
    <div class="editor-field">
        @(Html.Kendo().DatePickerFor(model => model.DateInvoiced))
        @Html.ValidationMessageFor(model => model.DateInvoiced)

    It is binding to a viewmodel where the DateInvoiced is a nullable datetime.
    When we add a record we don't want to provide this value yet, but when we hit the save button, the kendo datepicker is asking us to provide the value and is making this required.

    The model is nullable and does not have required attribute.

            [Display(Name = "Received")]
            public Nullable<DateTime> DateInvoiced { get; set; }

    How do we make the datepicker allow blank value?

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 25 Feb 2013 Link to this post

    Hi Nga,

    I am not able to reproduce such behavior. Could you please checked the attached project and see if I missed something? The BirthDate property is nullable and not required on my side.

    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!
Back to Top