|
@using System.Net.Http
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using {{YOUR PROJECT NAME}}
@using Syncfusion.Blazor
|
|
<head>
<base rel='nofollow' href="~/" />
. . .
. . .
@* For overall packages *@
<link rel='nofollow' href="_content/Syncfusion.Blazor/styles/material.css" rel="stylesheet" />
@* For individual packages *@
@* <link rel='nofollow' href="_content/Syncfusion.Blazor.Themes/material.css" rel="stylesheet" />*@
</head>
<body>
. . .
. . .
<script src="_framework/blazor.server.js"></script>
. . .
. . .
</body>
|
|
using Syncfusion.Blazor;
namespace {{your project name}}
{ public class Startup { .... .... public void ConfigureServices(IServiceCollection services) { .... services.AddServerSideBlazor(); services.AddSyncfusionBlazor(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { .... .... app.UseEndpoints(endpoints => { .... .... endpoints.MapBlazorHub(); }); } } } |
|
@using Syncfusion.Blazor.Grids
<SfGrid DataSource="@Orders" AllowPaging="true">
<GridPageSettings PageSize="5"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
@code{
public List<Order> Orders { get; set; }
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 75).Select(x => new Order()
{
OrderID = 1000 + x,
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Freight = 2.1 * x,
OrderDate = DateTime.Now.AddDays(-x),
}).ToList();
}
public class Order
{
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
}
}
|
|
<component type="typeof({{ YOUR PROJECT NAME }}.Views.Shared.Component)" render-mode="ServerPrerendered"/>
|