Hello,
I have a Telerik grid with data from a List<UserRoleModel> userRoles. This model and table (only) contains the fields UserId, and the RoleId.
I want to show the description of the Role (Field 'Description' of Table 'Roles where Roles.Id = RoleId') and the combined name of the user (Fields 'Firstname + Lastname' from table 'Users where Users.Id = UserId) in two extra custom grid columns next to the UserId and RoleId columns which are in the grid already (see code).
I probably have to use a column template and have been playing with that, but the documentation I could find is not clear and does not provide a clear sample. I could create two extra fields in the UserRoleModel but I can imagine that a more easy way is possible.
Hope that somebody can give me a simple sample / snippet.
regards, Marc Verkade
private List<UserRoleModel>? userRoles = new List<UserRoleModel>();
<TelerikGrid @ref="TheGrid"
Class="grid"
Data=@userRoles
Navigable="true">
<GridColumns>
<GridColumn Field="@nameof(UserRoleModel.UserId)" Title="User Id" />
<GridColumn Field="@nameof(UserRoleModel.RoleId)" Title="Role Id" />
<GridColumn Field="<The field Firstname + lastname from table Users>" Title="User name" />
<GridColumn Field="<The field Description' from table Roles" Title="Role name">
</GridColumns>
</TelerikGrid>