We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subjects - Lists via templated razor components to hide/show w/o if/then
https://www.codeproject.com/Tips/5363626/Templated-Data-container-with-Razor
`public class DataContainer : ComponentBase { [Parameter] public bool HasData { get; set; }
[Parameter] public RenderFragment DataTemplate { get; set; } = null!;
[Parameter] public RenderFragment NoData { get; set; } = null!;
protected override void BuildRenderTree(RenderTreeBuilder builder) { base.BuildRenderTree(builder); builder.AddContent(0, HasData ? DataTemplate : NoData); } }`
<DataContainer HasData="@(_value > 0)"> <NoData> <p>There is no data</p> </NoData> <DataTemplate> <div class="mb-8"> <p>There is content here</p> </div> </DataTemplate> </DataContainer>
The text was updated successfully, but these errors were encountered:
goodtocode
No branches or pull requests
Subjects - Lists via templated razor components to hide/show w/o if/then
https://www.codeproject.com/Tips/5363626/Templated-Data-container-with-Razor
`public class DataContainer : ComponentBase
{
[Parameter] public bool HasData { get; set; }
[Parameter] public RenderFragment DataTemplate { get; set; } = null!;
[Parameter] public RenderFragment NoData { get; set; } = null!;
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
base.BuildRenderTree(builder);
builder.AddContent(0, HasData ? DataTemplate : NoData);
}
}`
<DataContainer HasData="@(_value > 0)"> <NoData> <p>There is no data</p> </NoData> <DataTemplate> <div class="mb-8"> <p>There is content here</p> </div> </DataTemplate> </DataContainer>
The text was updated successfully, but these errors were encountered: