Hello,
I've been trying to make a name template for my Id column, but I keep getting the errors: "The name 'gameTerritory' does not exist in the current context" && "Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type"
I'm just trying to use my context to get the Id I need to grab the territory name. For some reason, I just can't use the Context like that. Any help would be appreciated. Thanks. Here's my code:
private List<Territory> territories;
private async Task LoadTerritoriesDialog() => await dialogService.OpenAsync("Territories", ds =>
@<RadzenCard Style="padding: 20px; ">
<div class="row">
<div class="col-md-12">
<RadzenGrid @ref="grdGameTerritory" AllowSorting="true" Data="@gameTerritories" TItem="GameTerritory" >
<Columns>
<RadzenGridColumn TItem="GameTerritory" Property="Id" Title="ID" Visible="false" />
<RadzenGridColumn TItem="GameTerritory" Property="GameId" Title="Game ID" Visible="false" />
<RadzenGridColumn TItem="GameTerritory" Property="TerritoryId" Title="Territory" Width="300px">
<Template Context="gameTerritory">
@territories.Where(x => x.Id == gameTerritory.TerritoryId).Select(x => x.Name).FirstOrDefault()
</Template>
</RadzenGridColumn>
<RadzenGridColumn Context="gameTerritory" TItem="GameTerritory" Property="OwnerId" Title="Power" Width="200px">
<Template Context="gameTerritory">
<RadzenDropDown @bind-Value="gameTerritory.OwnerId" AllowClear="true" Data="@powers" TextProperty="Name" ValueProperty="Id" />
</Template>
</RadzenGridColumn>
</Columns>
</RadzenGrid>
</div>
</div>
</RadzenCard>);