Telerik Grid - 日期列 - 过去日期过滤不起作用

时间:2014-05-08 16:05:18

标签: telerik telerik-grid telerik-mvc

我有以下代码,

   @(Html.Telerik().Grid(Model.Results)
            .Name("ResultsGrid")
            .NoRecordsTemplate("No records found.")
            .Columns(columns =>
            {

                columns.Bound(s => s.Id).Title("User Id").Template(
                        model => @Html.ActionLink(model.Id.ToString(), "Action1", "Controller1", new { UserId = model.Id}, new Dictionary<string, object>() { { "class", "xyz" } })
                ).Width(100);
                columns.Bound(s => s.Address).Title("Address").HeaderHtmlAttributes(new { title = "Address" });
                columns.Bound(s => s.City).Title("City").HeaderHtmlAttributes(new { title = "City" }).Width(140);
                columns.Bound(s => s.State).Title("State").HeaderHtmlAttributes(new { title = "State" }).Width(60);
                columns.Bound(s => s.Zip).Title("Zip").HeaderHtmlAttributes(new { title = "Zip" }).Width(100);
                columns.Bound(s => s.FromDate).Title("From Date").HeaderHtmlAttributes(new { title = "From Date" }).Format("{0:M/d/yyyy}").Width(160);
                columns.Bound(s => s.ToDate).Title("To Date").HeaderHtmlAttributes(new { title = "To Date" }).Format("{0:M/d/yyyy}").Width(180);
            })
            .ClientEvents(e => e.OnLoad("alignHeight")) 
            .DataBinding(dataBinding =>
            {
                dataBinding.Server().Select("SameAction", "SameController");
            })
            .Scrollable(sc => sc.Enabled(true))
            .Sortable(so => so.Enabled(true))
            .Pageable(paging => paging.PageSize(10).Style(GridPagerStyles.NextPreviousAndDropDown).Position(GridPagerPosition.Both))
            .Filterable(f => f.Enabled(true))
            .Groupable(g => g.Enabled(false))
            .Resizable(r => r.Columns(true))
        ) 

过滤日期列适用于当前和未来日期,但是当我尝试使用过去日期进行过滤时。网格显示&#34;未找到任何记录。&#34;我有过去日期的记录,我希望网格显示匹配过滤器。我试图通过应用&#34;过滤等于&#34;操作

我是否需要实施任何其他代码来处理Date列的过去日期?

1 个答案:

答案 0 :(得分:0)

我找到了解决问题的方法。在将DateTime绑定到Date之前。

相关问题