I not quite experience within Blazor and run into a problem. I use this code within a razor page to create a dropdown:
<select name="Gruppe">
<option value="-1" @onclick=@(() => GetVideosByGroup(-1)) @onclick:preventDefault="true">Alle</option>
@foreach (var group in _content)
{
<option value="@group.SubjectId" @onclick=@(() => GetVideosByGroup(group.SubjectId)) @onclick:preventDefault="true">@group.Name</option>
}
</select>
Within the code section I refresh the Page after selection changed:
@code {
...
private List<Content>? _subjects;
...
private async Task GetVideosByGroup(int groupId)
{
if (groupId == -1)
{
_subjects = await ContentsService.GetContentList();
}
else
{
_subjects = await ContentsService.GetContentListBySubject(groupId);
}
}
}
This runs fine within local execution. After publishing online, the page do not refresh anymore (all other Parts still works as expected). Even explicite calling of StateHasChange does take effect.
Have one any Idea or hints where to look for? The complete code also is available at GitHub (Razor Page on GitHub).
Thanks in advance