Created
August 15, 2019 17:15
-
-
Save EdCharbeneau/e261cbde936f38cee3befd4eb6d344e4 to your computer and use it in GitHub Desktop.
Working Grid with Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/fetchdata" | |
@inject HttpClient Http | |
@using Telerik.Blazor.Components.Grid | |
<h1>Weather forecast</h1> | |
<p>This component demonstrates fetching data from the server.</p> | |
<TelerikGrid Data="@forecasts" Pageable="true" Sortable="true" Filterable="true"> | |
<TelerikGridColumns> | |
<TelerikGridColumn Field="Date"> | |
<Template> | |
@((context as WeatherForecast).Date.ToShortDateString()) | |
</Template> | |
</TelerikGridColumn> | |
<TelerikGridColumn Field="TemperatureC" Title="Temp C'" /> | |
<TelerikGridColumn Field="TemperatureF" Title="Temp F'" /> | |
<TelerikGridColumn Field="Summary" /> | |
</TelerikGridColumns> | |
</TelerikGrid> | |
@code { | |
WeatherForecast[] forecasts; | |
protected override async Task OnInitializedAsync() | |
{ | |
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("sample-data/weather.json"); | |
} | |
class WeatherForecast | |
{ | |
public DateTime Date { get; set; } | |
public int TemperatureC { get; set; } | |
public int TemperatureF { get; set; } | |
public string Summary { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment