This question is locked. New answers and comments are not allowed.
I am fairly new to using Telerik MVC controls. But I can not get the datepickerFor to respect the [Required] data annotations.
I created a new MVC3 application using the telerik templates. When I run the application, the client side validation does not work.
Model Class:
public class DateTest
{
[Required] //does not work
public DateTime StartDate { get; set; }
[Required] //works
public string TestString { get; set; }
}
Index.cshtml
@using (Html.BeginForm())
{
<div>
@Html.EditorFor(m => m.TestString)
@Html.ValidationMessageFor(model => model.TestString)</div>
@Html.Telerik().DatePickerFor(m => m.StartDate)
@Html.ValidationMessageFor(model => model.StartDate)
<input type="submit" value="Send" />
}
How do I get @Html.Telerik().DatePickerFor to respect validation rules that are applied to my model? When I view my source the data-val fields do not appear to be rendering when I use the datepickerfor() method.
I've attached my vanilla project.
I created a new MVC3 application using the telerik templates. When I run the application, the client side validation does not work.
Model Class:
public class DateTest
{
[Required] //does not work
public DateTime StartDate { get; set; }
[Required] //works
public string TestString { get; set; }
}
Index.cshtml
@using (Html.BeginForm())
{
<div>
@Html.EditorFor(m => m.TestString)
@Html.ValidationMessageFor(model => model.TestString)</div>
@Html.Telerik().DatePickerFor(m => m.StartDate)
@Html.ValidationMessageFor(model => model.StartDate)
<input type="submit" value="Send" />
}
How do I get @Html.Telerik().DatePickerFor to respect validation rules that are applied to my model? When I view my source the data-val fields do not appear to be rendering when I use the datepickerfor() method.
I've attached my vanilla project.