Button click event does not react

Hi
in this code i can't get the click event working on the buttons. Most probably my error because little experience in Blazor.

What i try to reach is rach wit shelves and parts If i clack the part, i want to show or do something with te part data but i never get into the OnPartclick method.

Thanks for checking this code

@page "/Optimize"

@using System.Linq
@using OptiSort.DataTypes
@using OptiSort.Program
@using OptiSort.Services
@using Radzen
@using Radzen.Blazor
@inject IPartsOpti IPartsOptimize;

Parts Visualization

@foreach (var rack in parts.GroupBy(p => p.RackId).OrderBy(g => g.Key)) {

Rack @rack.Key

@foreach (var shelf in rack.GroupBy(p => p.ShelveId).OrderBy(g => g.Key)) {
Shelf @shelf.Key
@foreach (var part in shelf.OrderBy(p => p.Length)) {
                        <RadzenButton Style=@($"position: absolute; left: {part.StartXPosition * scaleFactor}px;width: {part.Length * scaleFactor}px; height:10px; margin-right: 5px;")
                                          Text=@($"Part {part.Id}")
                                         Click=@(args => OnPartClick(part))/>
                        }
                    </div>
                </div>
            </div>
        }
    </div>
}
@code {
    private const double scaleFactor = 0.05;

    private IEnumerable<Part> parts = Array.Empty<Part>();

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        parts = await IPartsOptimize.GetToDosAsync();
    }

    private void OnPartClick(Part part)
    {
        Console.WriteLine($"Part clicked: {part.Id}");
        // Add your custom logic here
    }
}

Hi @Dries.Viskens,

Make sure your page has interactivity enabled. It is required for events to work.