I have troubles with foreach loop

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

Nobody knows how can I do to improve this problem?

You can put a breakpoint in front of your @foreach or the { or the } with Visual Studio or Blazor Studio. Watch the values change as it loops when you debug.

Slosuenos

Looking again, you have columns, then nested in that you have RadzenDataGridColumns, and in those you have more nested columns, then more nested RadzenDataGridColumns? I don't think you can nest columns inside of another, but I may be wrong. I've never seen this.

Look at this Template inside Composite Columns - Radzen.Blazor Components - Radzen

Slosuenos