Hi there.
I have a Datagrid with columns that display DateTime values in the "0:HH:mm" format. If the value from the database is "2024-04-01 00:00:00", I want to display just nothing in the respective cell, not "00:00". How do I achieve that?
I tried CellRender:
protected void DataGrid0CellRender(Radzen.DataGridCellRenderEventArgs<ABschein.Models.ArbeitsscheinDB.Dienstplan> args)
{
string cell_content = args.Data.d_beginn.ToString();
if (cell_content.Contains("00:00:00"))
{
args.Attributes.Add("FormatString", " ");
}
}
with no avail. And I tried a Template:
<RadzenDataGridColumn TItem="ABschein.Models.ArbeitsscheinDB.Dienstplan" Property="d_beginn" Title="@L["DataGridColumn0.Title"]" Width="80px">
<Template Context="data">
@if ((data.d_beginn.ToString()).Contains("00:00:00"))
{
<div asp-for="DateTime" asp-format=" ">@data.d_beginn</div>
<span style='color:red'>@data.d_beginn</span>
}
</Template>
</RadzenDataGridColumn>
which adds the same value that exists colored red and unformatted. I tried it with coloring just to see if the criteria is met.
Thanks for your help in advance.