How to load additional data into a datalist inside a column template of a datagrid

Hi @rene,

Usually related data are exposed as sub properties that can be expanded. For example Customer-> Orders from Northwind database:

If there is no relationship you can perform a database call to get additional data using row data item.

A) To do this you can use pure no-code style approach with a CustomComponent to perform the database call on load:

  1. Create a page with no navigation that will server as component, perform database call on Load with the following filter and set the result to a property bound to heading Text:




  2. Add additional column to the DataGrid, define CustomComponent in the column Template and use the page from previous step as source. CustomerID is set as attribute:


  3. Run the application:

B) You can perform database call using a custom method defined in the page partial class:

  1. Define custom method:

  2. Execute the method when needed - in my case in column template:

  3. Run the application:

You can get the application illustrating all three approaches from here:
https://drive.google.com/file/d/19tlxXZbMbjck55AVMsMaOcxTS9nucXwz/view?usp=sharing

  • I'm my example I'm returning Count() of the detail records however you can extend it to return data and bind desired component to that data.
1 Like