Telerik MVC DatePicker in a Grid
I have a Telerik MVC DatePicker in a Telerik Grid. I want to let the users be able to delete or "clear out" the date. This is not working. There is some validation that prevents it. The type of the model in the e开发者_StackOverflow社区ditor template is a nullable date. Here is the editor template:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime?>" %>
<%= Html.Telerik().DatePickerFor(m => m) %>
Any ideas?
Steve
If I wanted the ability to null out a date. I had to check on the server sides Request.Forms collection
if(TryUpdateModel(item)) //item.EndDate will have the previous value, even if user nulled it out
{
if (Request.Form["EndDate"] == null) //only this will have a null value if user blanked it out
{
item.EndDate = null;
}
}
精彩评论