I have IEnumerable<POLine> summarylist; and
summarylist = await POLineService.POLineSummaryList(); in
protected override async Task OnInitializedAsync()
below are variables in my POLineService.cs
public decimal TotalSales { get; }
public decimal TotalAdd { get; }
public decimal TotalExpense { get; }
public decimal Balance { get; }
How can i get the values of those in the dashboard layer panel like this
|
@using Syncfusion.Blazor.Layouts
@using Dashboard_Sample.Services
@inject POLineService PolineService;
<div style="width:100%;">
<SfDashboardLayout Columns="4">
<DashboardLayoutPanels>
<DashboardLayoutPanel Row="0" Col="0">
<HeaderTemplate><div>Total Sales</div></HeaderTemplate>
<ContentTemplate>@PolineService.TotalSales</ContentTemplate>
</DashboardLayoutPanel>
<DashboardLayoutPanel Row="0" Col="1">
<HeaderTemplate><div>Total Add</div></HeaderTemplate>
<ContentTemplate>@PolineService.TotalAdd</ContentTemplate>
</DashboardLayoutPanel>
<DashboardLayoutPanel Row="0" Col="2">
<HeaderTemplate><div>Total Expense</div></HeaderTemplate>
<ContentTemplate>@PolineService.TotalExpense</ContentTemplate>
</DashboardLayoutPanel>
<DashboardLayoutPanel Row="0" Col="3">
<HeaderTemplate><div>Balance</div></HeaderTemplate>
<ContentTemplate>@PolineService.Balance</ContentTemplate>
</DashboardLayoutPanel>
</DashboardLayoutPanels>
</SfDashboardLayout>
</div> |
|
namespace Dashboard_Sample.Services
{
public class POLineService
{
public decimal TotalSales { get; } = 100;
public decimal TotalAdd { get; } = 200;
public decimal TotalExpense { get; } = 300;
public decimal Balance { get; } = 400;
}
} |
|
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
services.AddSingleton<POLineService>();
services.AddSyncfusionBlazor();
} |
Hi
Keerthana Rajendran
Thanks for the feedback.
actually i'm getting the data from an sql db using a stored procedure
i do have the service injected thus
@inject IPOLineService POLineService
and in my service
public async Task<IEnumerable<POLine>> POLineSummaryList()
{
IEnumerable<POLine> polines;
using (var conn = new SqlConnection(_configuration.Value))
{
polines = await conn.QueryAsync<POLine>("spPOLine_SummaryList", commandType: CommandType.StoredProcedure);
}
return polines;
}
i as well have
summarylist = await POLineService.POLineSummaryList();
in my async Task OnInitializedAsync()
--------------------
<ContentTemplate>@POLineService.TotalSales</ContentTemplate> gives an error