diff --git a/Radzen.Blazor/RadzenCarousel.razor.cs b/Radzen.Blazor/RadzenCarousel.razor.cs index 35784e85b04..fb5324e5fcd 100644 --- a/Radzen.Blazor/RadzenCarousel.razor.cs +++ b/Radzen.Blazor/RadzenCarousel.razor.cs @@ -101,9 +101,9 @@ async Task Next() async Task GoTo(int index) { - if (selectedIndex != index) + if (index >= 0 && index <= items.Count - 1 && selectedIndex != index) { - selectedIndex = index == items.Count ? 0 : index; + selectedIndex = index; await SelectedIndexChanged.InvokeAsync(selectedIndex); await Change.InvokeAsync(selectedIndex); await JSRuntime.InvokeVoidAsync("Radzen.scrollCarouselItem", items[selectedIndex].element);