Hi everybody,
I would like to print several columns inside the column that has like title name "Roles". The number of columns will be depending on the numbers of parameters collected by a list of objects of type parameters that are collected in gold razor.cs file.
Well, the problem is that at this moment the foreach loop should only go around two loops, and it actually goes around many more, ending up printing on the screen, if two columns but the titles of each column go wrong, the first column goes wrong. with empty title, and in the second column appears the title that should appear in the first column.
Do you know what it could be due to? Because I have reviewed the code well and I have done many tests and I cannot find the error.
It is not a problem of the list of parameters collected in the foreach, because I have done a test of changing it to a for loop with two iterations and it gives the same problems for many more loops than it should.
I paste here the code:
<RadzenButton Icon="add_circle_outline" style="margin-bottom: 10px; background-color:#9b1b30" Text="Nuevo" name="nuevoElemento" Click="@NuevoAuxMenuClick">
</RadzenButton>
<RadzenDataGrid @ref=@migrid TItem="Aux_Menu" AllowFiltering="true" AllowPaging="true" AllowSorting="true" RowSelect="@EditarGrid" Data="@listaAuxMenu" EmptyText="No existen registros" FilterMode="FilterMode.Simple">
<Template Context="context">
<AuxMenu CodigoPadre="@(context.IdMenu)"></AuxMenu>
</Template>
<Columns>
<RadzenDataGridColumn TItem="Aux_Menu" Property="Descripcion" Title="Descripción" Width="40%">
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Aux_Menu" Property="RutaComponente" Title="Ruta del componente" Width="20%">
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Aux_Menu" Property="Orden" Title="Orden en la tabla" Width="20%">
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Aux_Menu" Property="Icono" Title="Icono" Width="20%">
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Aux_Menu" Property="FiltroPagina" Title="Filtro de pagina" Width="20%">
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Aux_Menu" TextAlign="TextAlign.Center" Title="Roles" Width="120px" Resizable=true>
<Columns>
@foreach (Aux_Parametros rol in listaParametros)
{
<RadzenDataGridColumn TItem="Aux_Menu" Title="@rol.Parametro" TextAlign="TextAlign.Center" Resizable=true Width="40px">
<Template Context="data">
@if (data.multipleValuRoles.Contains(rol.Id.ToString()))
{
<img style="width:18px; height:18px" src="imagenes/checked2.png" />
}
</Template>
</RadzenDataGridColumn>
}
</Columns>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Aux_Menu" Filterable="false" Sortable="false" Width="70px" TextAlign="TextAlign.Center">
<Template Context="context">
<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="close" Size="ButtonSize.Small" Click="@((args) =>GridDeleteButtonClick(args, context))" @onclick:stopPropagation="true">
</RadzenButton>
</Template>
</RadzenDataGridColumn>
</Columns>
</RadzenDataGrid>
Thank you very much in advance for the answers.
Greetings