Telerik grid
This page shows a Telerik grid using two components, the TemplateHelper (which has nothing to do with Telerik, and can be used in any component that accepts templates) and the TelerikGridBoolFilter component.
The TemplateHelper cuts down on the amount of code you need to write when supplying a template, as it allows you to use a helper method to build the HTML for the template.
The TelerikGridBoolFilter component changes the row filter that the Telerik grid uses on a bool column from a default dropdown containing "All", "Is true" and "Is False" to a checkbox. This takes up a lot less space (usually a benefit on a bool column, as the contents tend to be smaller) and is more intuitive.
The grid below uses the TemplateHelper component as follows:
- Date
- This does two things to the date, it sets the text colour based on the temperature, and turns the text into a link (which doesn't go anywhere in this example). Both of these use the
Linkmethod overload that accepts aFuncfor the style, CSS and link title. This allows you to set these based on entity properties. - Temperature (C and F)
- These use the simple overload of the
Textmethod that takes a plain string for the style and CSS. In the sample below, it merely right-aligns the text - Rain
- Uses a
Rainbool property that I added to the standard weather forecast model, and uses theFuncoverload of theTextmethod to set an icon based on whether or not it will rain. As you can see, the result is a lot better than the default (which you can see in the "Rain default" column)
It also uses the TelerikGridBoolFilter component in the Rain column to create a much simpler filter than the one the Telerik grid supplies by default.
See the source code for this page for the code that produces the grid below, or the TemplateHelper source code for the method definitions and comments
| Date | Temp (C) | Temp (F) | Rain? | Rain default | Summary |
|---|---|---|---|---|---|
(All)
|
| 4th July 2026 | 37 | 98 | True | Balmy | |
| 5th July 2026 | 0 | 32 | False | Scorching | |
| 6th July 2026 | -7 | 20 | False | Hot | |
| 7th July 2026 | 36 | 96 | False | Sweltering | |
| 8th July 2026 | 6 | 42 | False | Cool | |
| 9th July 2026 | 46 | 114 | False | Balmy | |
| 10th July 2026 | 32 | 89 | False | Warm | |
| 11th July 2026 | 34 | 93 | True | Cool | |
| 12th July 2026 | 13 | 55 | True | Sweltering | |
| 13th July 2026 | -10 | 15 | False | Balmy | |
| 14th July 2026 | 12 | 53 | True | Balmy | |
| 15th July 2026 | -18 | 0 | True | Mild | |
| 16th July 2026 | 23 | 73 | False | Freezing | |
| 17th July 2026 | 43 | 109 | True | Balmy | |
| 18th July 2026 | 15 | 58 | True | Bracing |