This is a migrated thread and some comments may be shown as answers.

Filtering date as string

1 Answer 293 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Víctor asked on 17 Apr 2019, 12:43 PM


I'm evaluating the grid with the trial version to see if your solution fits into our web application.

I'm trying to adapt the grid in our web MVC and I've encountered a problem with the filters date.

We need to enter "> = 1.1.2018" or "1.1.2018#31/12/2018" and it reaches FileDescriptor request as a value. With this i build the query to launch the SQL server. 

 Now no Filters arrive to request  from ajax "Consulta_Viajes"

   .Columns(columns =>
        {columns.Bound(c => c.itdavia).Hidden();
         columns.Bound(c => c.ctdavia).Title(LocalizationResources.Strings.viaje);
         columns.Bound(c => c.ctrnest).Title(LocalizationResources.Strings.codigo_estado);
         columns.Bound(c => c.dtrnest).Title(LocalizationResources.Strings.estado);
         columns.Bound(c => c.ftdavia).Title(LocalizationResources.Strings.fecha_viaje).Groupable(false).Format("{0:dd/MM/yyyy}").Width(150);
         columns.Bound(c => c.htdavia).Title(LocalizationResources.Strings.hora_viaje).Groupable(false).Format("{0:HH:mm}");
         columns.Bound(c => c.cdvn).Title(LocalizationResources.Strings.codigo_division);
    .Filterable(ftb => ftb.Mode(GridFilterMode.Row)
   .Resizable(resize => resize.Columns(true))
   .Reorderable(reorder => reorder.Columns(true))
   .DataSource(dataSource => dataSource
      .Read("Consulta_Viajes", "AsignacionMensajero", new { strTabla = "tdavia" })


How can I do this?

Thanks in advance.



1 Answer, 1 is accepted

Sort by
Konstantin Dikov
Telerik team
answered on 19 Apr 2019, 09:41 AM
Hello Victor,

If the underlying field that you need to filter is of DateTime type, you will have to use custom filter for the column in order to change the default filter component, so that it could allow entering string values instead of valid Date objects:
Another option would be to change the property in the model to string, which will allow you to filter with string values.

Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question