0

I am using Grid.mvc in this link:

https://gridmvc.codeplex.com/

When I use Date filter it shows the calendar but by selecting the date nothing is happening. other kind of filters like text and bool are working fine. I already referench the "Grid.Mvc DatePicker"

This is my code:

 @Html.Grid(Model).Columns(columns =>
  {
columns.Add(model => model.dataUser).Titled("User").SetWidth(110);
columns.Add(model => model.Create_Date).Titled("Create Date").SetWidth(110).Filterable(true).Format("{0:dd/MM/yyyy}");
columns.Add(model => model.Modified_Date).Titled("Modified Date").SetWidth(110).Filterable(true).Format("{0:dd/MM/yyyy}");
 }).WithPaging(20).Sortable().Filterable().WithMultipleFilters()
tereško
  • 58,060
  • 25
  • 98
  • 150
Alma
  • 3,780
  • 11
  • 42
  • 78
  • 1
    Have you added bootstrap.min.js and bootstrap-datepicker.js? check [here](http://stackoverflow.com/questions/30837665/grid-mvc-date-filter) – Hadee Nov 11 '15 at 20:24
  • @Hadee yes, I have added. – Alma Nov 11 '15 at 22:05
  • 1
    I am not sure but may be changing format works. Chang it to : "Format("{0:yyyy-MM-dd}" – Hadee Nov 11 '15 at 22:14
  • @Hadee have you add any method in your controller for [Httppost]? – Alma Nov 11 '15 at 22:38
  • @Hadee I found out the Equal is not working for date , less than and greater than is working! – Alma Nov 11 '15 at 22:47
  • have you changed the format? – Hadee Nov 11 '15 at 22:49
  • @Hadee Yes, same. But now I am getting it refreshed. just the equal is not working. As you suggest problem was bootstrap-datepicker.js. – Alma Nov 11 '15 at 22:51
  • So that is only code I have for date column:columns.Add(model => model.Create_Date).Titled("Create Date").SetWidth(110).Filterable(true).Format("{0:dd/MM/yyyy}"); (I tested with different date formatting) – Alma Nov 11 '15 at 22:54

1 Answers1

0

You may need to convert DateTime property into Date only.

c.Add(x => x.DOB.Date).Titled("Date of Birth").Filterable(true).Sortable(true);

For nullable DateTime it would be tricky, the best is to create additional r/o DateOnly property, and use it.

sam sergiy klok
  • 526
  • 7
  • 17