Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@enchev @akorchev
61 lines (52 sloc) 2.31 KB
@page "/datalist"
@using NorthwindBlazor.Data
@using NorthwindBlazor.Models.Northwind
@using Microsoft.EntityFrameworkCore
@inject NorthwindContext dbContext
<h1 style="display:inline">DataList</h1><a style="margin-left: 10px" href="https://github.com/akorchev/blazor.radzen.com/blob/master/Pages/DataListPage.razor" target="_blank">[source code]</a><a style="margin-left: 10px" href="https://www.radzen.com/documentation/blazor/datalist/" target="_blank">[documentation]</a>
<p>This page demonstrates <b>DataList</b> component.</p>
@if (orders == null)
{
<p><em>Loading...</em></p>
}
else
{
<RadzenDataList WrapItems="true" AllowPaging="true" Data="@orders" TItem="Order">
<Template Context="order">
<RadzenCard Style="width:300px;">
<div class="row">
<div class="col-md-6">
<div>Company:</div>
<b>@order.Customer?.CompanyName</b>
<div style="margin-top:20px">Employee:</div>
<b>@(order.Employee?.FirstName + " " + order.Employee?.LastName)</b>
<br />
<RadzenImage Path="@order.Employee?.Photo" Style="width:100px;" />
</div>
<div class="col-md-6">
<div>Freight:</div>
<b>@String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", order.Freight)</b>
<div style="margin-top:20px">Ship country:</div>
<b>@(order.ShipCountry)</b>
<div style="margin-top:20px">Ship city:</div>
<b>@(order.ShipCity)</b>
<div style="margin-top:20px">Ship name:</div>
<b>@(order.ShipName)</b>
</div>
</div>
</RadzenCard>
</Template>
</RadzenDataList>
}
@code {
IEnumerable<Order> orders;
protected override async Task OnInitializedAsync()
{
orders = await Task.FromResult((from order in dbContext.Orders
.Include("Customer")
.Include("Employee")
.Include("OrderDetails")
.Include("OrderDetails.Product")
select order));
}
}
You can’t perform that action at this time.