Hi,
I'm looking for a way to prevent or defer a tab change in RadzenTabs based on the current tab's state, and I can't find a supported mechanism for it.
Use case
One of my tabs contains a input. When the user has made changes that are not yet saved (the input is "dirty") and then clicks another tab, I want to:
- Intercept the tab change before it happens,
- Show a confirmation dialog ("You have unsaved changes. Discard them and switch, or stay and save first?"), and
- Either allow the switch (user chose Discard) or cancel it and keep the user on the current tab (user chose Save / Cancel).
The problem
As far as I can tell, RadzenTabs only exposes events that fire after the tab has already switched:
- Change / SelectedIndexChanged are raised once the new tab is already active.
There doesn't seem to be a cancelable "before change" hook — nothing like a Changing event with a Cancel flag, or an async callback whose result could veto the switch (e.g. Func<int, Task>).
Because of this, by the time I learn about the change, the user is already on the new tab, so I can't cleanly block the navigation.
My questions
- Is there a supported way to intercept/cancel a tab change before it takes effect that I've missed?
- If not, what is the recommended pattern for an "unsaved changes" guard with RadzenTabs today? Is forcing SelectedIndex back to the previous value in the Change handler (after an async confirmation dialog) the intended approach, or is there something cleaner?
- Are there any plans to add a cancelable "Changing"/"BeforeChange" event (ideally async, so it can await a dialog result)?
Environment: Radzen.Blazor 11, .NET 10, render mode Server.
Thanks a lot for any guidance!