Repeater
Repeater Example
Date | Temp. (C) | Temp. (F) | Summary |
---|---|---|---|
2018/5/6 | 1 | 33 | Freezing |
2018/5/7 | 14 | 57 | Bracing |
2018/5/8 | -13 | 9 | Freezing |
2018/5/9 | -16 | 4 | Balmy |
2018/5/10 | -2 | 29 | Chilly |
@inherits ControlComponent
@inject HttpClient Http
<table cellpadding="2" width="640px" border="1">
<asp.Repeater DataSourceID="FreeDataSource1">
<HeaderTemplate>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</HeaderTemplate>
<ItemTemplate TItem="WeatherForecast">
<tr>
<td>
@string.Format("{0:yyyy/M/d}", context.Date)
</td>
<td>
@context.TemperatureC
</td>
<td>
@context.TemperatureF
</td>
<td>
@context.Summary
</td>
</tr>
</ItemTemplate>
</asp.Repeater>
</table>
<asp.FreeDataSource ID="FreeDataSource1" OnExecuteSelected="sender => this.forecasts" />
@code {
private WeatherForecast[] forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
}
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public string Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}
Repeater Metadata
Name | Type | Kind | |||
---|---|---|---|---|---|
Attributes | IReadOnlyDictionary | Parameter | |||
ChildLevel | Int32 | Parameter | |||
ClientIDMode | ClientIDMode | Parameter | |||
DataMember | String | Parameter | |||
DataSourceID | String | Parameter | |||
ID | String | Parameter | |||
Visible | Boolean | Parameter | |||
OnCallingDataMethods | CallingDataMethodsEventHandler | Event | |||
OnCreatingModelDataSource | CreatingModelDataSourceEventHandler | Event | |||
OnDataBinding | EventHandler | Event | |||
OnDisposed | EventHandler | Event | |||
OnInit | EventHandler | Event | |||
OnItemCommand | RepeaterCommandEventHandler | Event | |||
OnItemCreated | RepeaterItemEventHandler | Event | |||
OnItemDataBound | RepeaterItemEventHandler | Event | |||
OnLoad | EventHandler | Event | |||
OnPreRender | EventHandler | Event | |||
OnUnload | EventHandler | Event | |||
AlternatingItemTemplate | AlternatingItemTemplate | InnerProperty | |||
|
|||||
FooterTemplate | FooterTemplate | InnerProperty | |||
|
|||||
HeaderTemplate | HeaderTemplate | InnerProperty | |||
|
|||||
ItemTemplate | ItemTemplate | InnerProperty | |||
|
|||||
SeparatorTemplate | SeparatorTemplate | InnerProperty | |||
|