Conditionally render RadzenDataGrid child render fragments

I have made in my app a special RadzenDataGrid and I need to be able to conditionally render the HeaderTemplate. If I let the HeaderTemplate be without an if statement, then if the parent component does not give a HeaderTemplateContent, then the table will render and will have a white line where the header template should be.

If I put the if statement however, the project does not build because the HeaderTemplate can't be resolved in the if statement. Do you have any suggestions on how I could achieve this ?

There is no way in razor syntax to do that - the only way is to have separate declaration with template and without template. Other possible solution will be to use RenderTreeBuilder to create the component programmatically - you can check official Microsoft documentation for reference.

1 Like

Thank you for the confirmation :+1: