DataList template as standalone Razor component

In all the DataList examples, the template is defined within the DataList. Is it possible to have the template as an standalone Razor component? If so, how do I integrate the template Razor component and the DataList?

Thanks!

1 Like

Yes, this is possible. Create a component as usual and set its properties from the template context:

<Template Context="order">
   <MyCustomComponent Text=@order.OrderName Date=@order.OrderDate />
</Template>
2 Likes

Thank you very much!!!!

I am back a year later...

I created a component in a .cs file with the root element as RadzenCard. The idea is to separate this implementation with the RadzenDataList which sits in a different file. Is this even allowed?

What does that mean?