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)
|
| 24th July 2026 | -7 | 20 | False | Mild | |
| 25th July 2026 | -15 | 6 | True | Chilly | |
| 26th July 2026 | 50 | 121 | False | Balmy | |
| 27th July 2026 | 31 | 87 | True | Warm | |
| 28th July 2026 | -20 | -3 | True | Bracing | |
| 29th July 2026 | 6 | 42 | False | Balmy | |
| 30th July 2026 | 4 | 39 | True | Scorching | |
| 31st July 2026 | 42 | 107 | False | Cool | |
| 1st August 2026 | 17 | 62 | True | Chilly | |
| 2nd August 2026 | 50 | 121 | False | Sweltering | |
| 3rd August 2026 | -17 | 2 | False | Hot | |
| 4th August 2026 | 26 | 78 | False | Mild | |
| 5th August 2026 | -14 | 7 | False | Freezing | |
| 6th August 2026 | 27 | 80 | True | Sweltering | |
| 7th August 2026 | 33 | 91 | False | Warm |