Compare dateTo with dateTime.Now and display an image

0 Answers 69 Views
Grid
Marina
Top achievements
Rank 1
Iron
Marina asked on 01 Apr 2022, 02:50 PM | edited on 01 Apr 2022, 02:51 PM

Hello!

I have a grid in which I need to display if my record is active or not. I have an expiration date (dateTo field) which I need to compare it with dateTime now. If the dateTo is earlier than today then an image is not be displayed. Lets say "active image" if not then to display the "no active image".

Is that possible?

thank you!


@(Html.Kendo().Grid<ElkeSite.Models.Records>() .Name("grid") .Columns(columns => { columns.Bound(c => c.ID).Hidden(); columns.Bound(c => c.Title); columns.Bound(c => c.DateTo).Filterable(); columns.Bound(?); }) .HtmlAttributes(new { style = "height: 600px;" }) .Scrollable() .Sortable() .Filterable() .Groupable() .Sortable() .Pageable(pageable => pageable .Refresh(true) PageSizes(true) .ButtonCount(5) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("Read", "Records")) .PageSize(10)).NoRecords(x => x.Template("<div class='empty-grid'></div>")) .ToolBar(toolbar => { //toolbar.Excel();

//toolbar.Pdf(); }) )


Marina
Top achievements
Rank 1
Iron
commented on 05 Apr 2022, 07:12 AM | edited

I found out a solution which help me to solve my issue. Thank you

https://stackoverflow.com/questions/50281716/comparing-dates-in-kendo-html-grid-client-template

Yanislav
Telerik team
commented on 06 Apr 2022, 06:40 AM

Hello Marina,

Thank you for sharing the solution you've found with the community. It will surely help someone who is working on a similar to your scenario.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Marina
Top achievements
Rank 1
Iron
Share this question
or