Razorpages: Render content dynamically but put result into closeable layout

Viewed 16

I am rendering this loop of data:

    foreach (var solution in product.Solutions)
    {
        var id = "ContentLeft_"+solution.Id;
    
        <tr id="@id" class="@if (isOdd){<text>Odd</text>} @if (solution.PriorityAsBool){<text> Favorite</text>}">
            @Html.Partial("_SolutionLeft",solution, new ViewDataDictionary { { "PositionNr", positionNr}, { "ProductCategoryId", Model.ProductCategoryId } } )
        </tr>
    
        isOdd = !isOdd;
        positionNr++;
}

Which works fine and looks like this:

enter image description here

But since I rendere many of these, and sometimes the list does not contain only 2 items but 20, I would much rather have this be rendered inside a layout that you would need to open first.

How would you go on about this?

Thank you

0 Answers
Related