Add ASP.NET Core generated antiforgery token to RadzenTemplateForm<TItem>

My aim is to somehow extend the RadzenTemplateForm component in order to include in its HTML form element the ASP.NET core generated antiforgery token input field.
To achieve that I decided that I should inherit from this component. The descendant component makes the necessary DOM modification via JS.
I was also expecting that I could use the descendant component just like the parent RadzenTemplateForm (just the beginning of the declaration shown):

image

But nothing is rendered in the browser, with no errors being thrown too.
I guess there are more things that I have to account for when it comes to inheriting from a generic component, or it has something to do with the ChildContent property, I don't know. Any guidance is welcomed. Thank you for the time.

Hi @iliyan.kulishev,

How do you render the child content of the form? Maybe instead of inheriting from the form you can just encapsulate it - make your form render <RadzenTemplateForm> on its own and set the required properties. In any case the rendering logic of the form is here.

@korchev
Thanks for the reply.

I found a solution.
There is no rendering logic for the child. I just want to be able to declare it in other Blazor components having the same properties and rendering logic as if it's the parent. The only difference should be that the child adds one more input element in the form of the parent.

For some reason it worked only as having the descendant component defined in a C# class file and not a .razor file. It is way cleaner anyway, since I don't need any Razor syntax.

image

In _Host.cshtml
image

JS
image

Result

Indeed it work work if you inherit from a razor file. It will not call the base BuildRenderTree method by default.