|
<SfGrid DataSource="@OrderData" AllowPaging="true">
<GridColumns>
<GridColumn Field=@nameof(Orders.CustomerID) HeaderText="Customer Name" Width="150">
<Template>
@{
var val = (context as Orders);
var returned = @GetValue(val);
<span>@returned.ToString()</span>
}
</Template>
</GridColumn>
</GridColumns>
</SfGrid>
@code{
public List<Orders> OrderData { get; set; }
public List<Employee> EmployeeData { get; set; }
public bool GetValue(Orders Value)
{
if (EmployeeData.Where(x => x.EmployeeName == Value.CustomerID).Count() > 0) // check the condition and return the value
{
return true;
}
else
{
return false;
}
}
protected override async Task OnInitializedAsync()
{
OrderData = await ForecastService.GetOrderAsync();
EmployeeData = await ForecastService.GetNewData(); // store the second table datasource is global variable
}
|