How paint row in datagrid

Hello, how i can paint my row, as in the screenshot. Green is not painted correctly, but blue and gray is correctly painted.

Blue - it select row
Gray - it weekend and paint like css-class through RadzenDataGridColumn

My code:

                var daysInMonth = DateTime.DaysInMonth(Schedule.Year, Schedule.Month);
                for (var day = 1; day <= daysInMonth; day++)
                {
                    var currentDay = day;
                    var index = day - 1;
                    var dateTime = new DateTime(Schedule.Year, Schedule.Month, day);
                    var cssClass = "";

                    switch (dateTime.DayOfWeek)
                    {
                        case DayOfWeek.Saturday:
                        case DayOfWeek.Sunday:
                            cssClass = "holiday-row";
                            break;
                    }

                    var holiday = Schedule.CalendarHolidays.FirstOrDefault(x => x.Date.Day == currentDay);
                    if (holiday is not null)
                        cssClass = "holiday-row";

                    <RadzenDataGridColumn TItem="MonthScheduleModel" Title=@($"{day}") Width="3rem" Filterable="false" Sortable="false" CssClass="@cssClass">
                        <Template Context="schedule">
                            @{
                                var day = schedule.MonthSchedule.UserVisits.ElementAt(index);
                                var colorInt = day.AbscenceType?.Color;
                                Color? color = colorInt.HasValue ? Color.FromArgb(colorInt.Value) : null;
                                var background = color.HasValue ? ColorExtensions.HexConverter(color.Value) : "transparent";
                                var style = $"background: {background}; padding: 0 5px;";
                            }
                            <RadzenText Style="@style">@schedule.MonthSchedule.UserVisits.ElementAt(index).HoursCount</RadzenText>
                        </Template>
                        <EditTemplate Context="schedule">
                            @{
                                var day = schedule.MonthSchedule.UserVisits.ElementAt(index);
                            }
                            <RadzenNumeric @bind-Value="@day.HoursCount" ShowUpDown="false"/>
                        </EditTemplate>
                        <FooterTemplate>
                            <span class="rz-cell-data">@Schedule?.MonthSchedules?.Select(x => x.MonthSchedule.UserVisits.ElementAt(index)).Sum(x => x.HoursCount)</span>
                        </FooterTemplate>
                    </RadzenDataGridColumn>
                }

solved the problem via: OnCellRender(DataGridCellRenderEventArgs<T> args)

Hello, good afternoon.
Please, could you give me more details about it? I have the same issue.
Thanks.

Good afternoon, I really don’t remember what the problem was, sorry
Attached below is a snippet of the code that I use in this place

    public void OnCellRender(DataGridCellRenderEventArgs<MonthScheduleModel> args)
    {
        if (!int.TryParse(args.Column.Title, out var day) || PersonalMonthScheduleModel is null)
            return;

        if (!string.IsNullOrWhiteSpace(args.Column.CssClass))
            args.Column.CssClass = string.Empty;

        var workDay = PersonalMonthScheduleModel.WorkDaysNumbers.FirstOrDefault(wdn => wdn == day);
        var userVisit = args.Data.MonthSchedule.UserVisits.FirstOrDefault(uv => uv.Day == day);

        if (workDay is default(int))
            args.Column.CssClass = "rz-cell-weekend";
}
1 Like

Thanks a lot for your response.
Regards.