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

[Solved] Second Post - Required DataAnnotation Doesn't Work With DatePicker

2 Answers 72 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David Guthu
Top achievements
Rank 1
David Guthu asked on 02 Feb 2011, 06:08 AM
Hi,

I'm using telerik controls version 2010.3.1110.340.  Asp.net MVC 3.  I'm trying to get the datepicker to validate client side using the required attribute. Unobtrusive javascript is on, and enable client validation - both through web.config. I can't seem to figure out what I'm doing wrong..

Model:

        /// <summary>
        /// Date of birth
        /// </summary>
        [DataType(DataType.Date), Required]
        public DateTime? DateOfBirth { getset; }
View:

<div class="editor-field">
    <%= Html.Telerik().DatePickerFor(m => m.DateOfBirth) %>
<%--    <%: Html.EditorFor(m => m.DateOfBirth)%>--%>
    <%: Html.ValidationMessageFor(m => m.DateOfBirth) %>
</div>
As you can see I was using an EditorFor but I disabled it to try and figure this out.

Site.Master top:

                <%= Html.Telerik().StyleSheetRegistrar()
                      .DefaultGroup(group => group
                          .Add("telerik.common.min.css")
                          .Add("telerik.vista.min.css")
                          .Add("telerik.rtl.css"))
                     %>


Site.Master bottom:

            <% Html.Telerik().ScriptRegistrar() 
                    .DefaultGroup(group => group
                    .Add("jquery.validate.js")
                    .Add("jquery.validate.unobtrusive.js")                     .Render(); %>

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 02 Feb 2011, 10:09 AM
Hello David,

 
I will suggest you upgrade to version 2010.3.1318 of Telerik Components for ASP.NET MVC, which is SP1 of Q3 release. 

For your convenience I have attached simple test project which shows how to implement client validation.

Best regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vinicius
Top achievements
Rank 1
answered on 28 Sep 2011, 10:04 PM
I had the same problems as above, the files you have not worked PROVIDE.

awaiting response
Tags
Date/Time Pickers
Asked by
David Guthu
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Vinicius
Top achievements
Rank 1
Share this question
or