Change tabs in RadzenTabs only after validation

I would like to make some sort of validations before allow user to change current tab with the selected new one.

I have defined my tabs as follow:

<RadzenTabs TabPosition="TabPosition.Top" RenderMode="TabRenderMode.Server" Change="@(async args => { await OnTabChange(args); })" SelectedIndex="selectedIndex">
        <RadzenTabsItem Text="MainDataTab">
        <RadzenTabsItem Text="SecondaryTab">

and in the code behind I have the following method:

private async Task OnTabChange(int index)
                var confirmResult = await DialogService.Confirm("Sure?", "Warning", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No" });
                if (confirmResult.HasValue && confirmResult.Value)
                    selectedIndex = index;

But the control renders the new tab before I make my dialog popup choice.
How I have to do?

Thank you very much

Hi @davide.n,

RadzenTabs fires the Change event after changing the tab. There isn't a way to prevent tab changing from happening.

As a workaround I can suggest using RadzenSteps which supports validation components - if you place it inside RadzenTemplateForm the user will not be able to change steps until the current step is valid. Using validation is also not mandatory - our steps demo shows how one can disable steps conditionally.

Thank you.
But you'll add this feature to RadzenTabs?

Hey @davide.n,

Radzen.Blazor is open source library, we accept pull requests!