If you don't update your view-model and the tab strip binds to an tab index field, you will effectively cancel the event, as is the typical behavior of two-way binding.
Here's an example I made for you:
<TelerikTabStrip ActiveTabIndex="@ActiveTabIndex" ActiveTabIndexChanged="@TabChangedHandler">
<TabStripTab Title="First">
First tab content. Click through the tabs.
</TabStripTab>
<TabStripTab Title="Second">
Second tab content.
</TabStripTab>
<TabStripTab Title="Third">
Third tab content.
</TabStripTab>
</TelerikTabStrip>
@code {
int ActiveTabIndex { get; set; }
voidTabChangedHandler(int newIndex)
{
// this will update the view-model for all items but the third, // effectively cancelling the event for the third tabif (newIndex != 2)
{
ActiveTabIndex = newIndex;
}
}
}
Regards,
Marin Bratanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Is there a way to prevent the tab change event from happenning at all. When I use this method and I have a Razor Component in my tab contenxt, it rerenders the component causing it to load all of my data again in the OnInitializedAsync() call. I'd like to stop that from happening if certain conditions are met.