You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
D:\projects\MS.CRM.Clients\MS.CRM.BlazorWebAssembly\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_Debug_razor.g.cs(532,283,532,293): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace '__Blazor.Microsoft' (are you missing an assembly reference?)
DataList.razor:
@typeparam T
@if (DataListTemplate == null)
{
<ul>
@foreach (var item in Data ?? Array.Empty<T>())
{
@ItemTemplate(item)
}
</ul>
}
else
{
@DataListTemplate(
@:@{
foreach (var item in Data ?? Array.Empty<T>())
{
ItemTemplate(item)
}
}
)
}
@code {
[Parameter]
public IEnumerable<T> Data { get; set; } = null!;
[Parameter]
public RenderFragment<T> ItemTemplate { get; set; } = null!;
[Parameter]
public RenderFragment<RenderFragment>? DataListTemplate { get; set; } = item => @item;
protected override void OnInitialized()
{
if (Data == null) throw new ArgumentNullException(nameof(Data));
if (ItemTemplate == null) throw new ArgumentNullException(nameof(ItemTemplate));
base.OnInitialized();
}
}
How i use:
@page "/debug"
<div class="container">
<DataList Data="@Persons">
<DataListTemplate Context="Data">
<table>
<thead>
<tr>
<th>Salutation</th>
<th>Given name</th>
<th>Family name</th>
</tr>
</thead>
<tbody>
@Data
</tbody>
</table>
</DataListTemplate>
<ItemTemplate>
<li @key="context">@context.Name (Age: @context.Age)</li>
@* <li>@context</li> *@
</ItemTemplate>
</DataList>
</div>
@code {
public class Person
{
public Person(string Name, int Age)
{
this.Name = Name;
this.Age = Age;
}
public string Name { get; init; }
public int Age { get; init; }
}
IEnumerable<Person> Persons;
protected override void OnInitialized()
{
base.OnInitialized();
Persons = new[]
{
new Person("Alex", 10),
new Person("Lecy", 20),
new Person("Suzi", 15),
};
}
}
Pls, can you help me?
I also get error hint in my ide for Wig-Pig syntax:
The text was updated successfully, but these errors were encountered:
Hi, I'm learning from your website. I have reached the lesson https://blazor-university.com/templating-components-with-renderfragements/passing-placeholders-to-renderfragments/
And I ran into the problem that I can't pass the template to the
DataListTemplate
parameter of theRenderFragment<RendetFragment>
type of theDataList
component. I get the following error during the build:DataList.razor
:How i use:
Pls, can you help me?
I also get error hint in my ide for Wig-Pig syntax:
The text was updated successfully, but these errors were encountered: