Roles are empty as they are not included by default. Here is how to display them.
- Open SecurityService.cs and change the GetUsers method to this:
public async Task<IEnumerable<ApplicationUser>> GetUsers() { var uri = new Uri(baseUri, $"ApplicationUsers"); uri = uri.GetODataUri(expand:"Roles"); // Get the roles as well var response = await httpClient.GetAsync(uri); var result = await response.ReadAsync<ODataServiceResult<ApplicationUser>>(); return result.Value; }
- Set the Template of the Roles data grid column to this:
<RadzenDataGridColumn TItem="YourApp.Models.ApplicationUser" Property="Roles"> <Template> @string.Join(", ", context.Roles.Select(r => r.Name)) </Template> </RadzenDataGridColumn>
The final result would look like this: