Home > Net >  How to filter by date with Field using Blazor DxDataGridColumn DevExpress?
How to filter by date with Field using Blazor DxDataGridColumn DevExpress?

Time:10-27

I'm trying make function the searching when the user fill the Field of date in DxDataGridColumn, as image below:

enter image description here

But the searching don't function.

In razor.cs I maked this:

private ValueDTO valueDTO;

private string importDateValue => this.valueDTO.ImportDate.Value.ToString("dd/MM/yyyy HH:mm:ss");

And in the razor file I uused the code below:

<DxDataGridColumn Caption="@Localizer\["Data de Importação"\]"
                  Field="importDateValue"
                  Width="170px"\>
                  <DisplayTemplate\>
                          @{
                              var item = context as ValueSummaryDTO;
                              if (item?.ImportDate != null && item?.ImportDate.Value != DateTimeOffset.MinValue)
                           {
                              <span\>@item.ImportDate.Value.ToString("dd/MM/yyyy HH:mm:ss")\</span\>
                           }
                           }
                  </DisplayTemplate\>
</DxDataGridColumn\>

But the result of search don't right function. Someone can help me?

CodePudding user response:

I guess you need to have a property inside your SummaryDTO with the date already converted to string. Then, you can bind the DxDataGridColumn to this property. It should behave as any other text field.

  • Related