开发者

Telerik MVC DatePicker in a Grid

开发者 https://www.devze.com 2023-04-11 12:20 出处:网络
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 mode

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;
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号