insert custom row in grid

1 Answer 11 Views
Grid
Johan
Top achievements
Rank 2
Iron
Iron
Johan asked on 09 Feb 2026, 11:09 AM | edited on 09 Feb 2026, 11:10 AM

I have a simple grid with a list object, where one property is a date and the other a string. The grid is sorted on dates. I want to insert a custom <tr> row before the "normal" row if the month changes, containing a single <td> cell with the year and month.

I've looked at the <RowTemplate> but if I try to insert a <tr> in there, the whole table is broken because the rowtemplate should not (as I understand it) not contain a tr but only td cells.

Anyone?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 09 Feb 2026, 12:20 PM

Hi Johan,

A possible way to achieve the desired result is to group the Grid initially by the Date column. Use the Grid OnStateInit event for that. Optionally, use a GroupHeaderTemplate if you need it for some reason.

In general:

  • One item in the Grid data collection corresponds to one table row in the component.
  • The Grid RowTemplate is designed for a single table row, because the <tr> tag is outside the template.
  • The Grid can't render fake rows that have no functional purpose related to an existing built-in feature. All non-data rows are managed exclusively by the Grid (for example, group rows and detail rows).

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Johan
Top achievements
Rank 2
Iron
Iron
commented on 09 Feb 2026, 09:22 PM | edited

Yes I tried that, I use a "month" hidden column to sort on, but the grouped item/month is sorted ascended, and I want it to be sorted descending. Setting the gridstate sorting doesn't help. I found a ticket for this issue. Hope it will be implemented and released soon. Until then I have to create a simple list or a table manually. 
Dimo
Telerik team
commented on 10 Feb 2026, 07:08 AM

@Johan

When grouping the Grid programmatically, you can set a sort direction:

    private void OnGridStateInit(GridStateEventArgs<Product> args)
    {
        // Group by Release Date
        args.GridState.GroupDescriptors.Add(new GroupDescriptor()
        {
            Member = nameof(Product.ReleaseDate),
            MemberType = typeof(DateTime),
            SortDirection = ListSortDirection.Descending
        });
    }

Tags
Grid
Asked by
Johan
Top achievements
Rank 2
Iron
Iron
Answers by
Dimo
Telerik team
Share this question
or