Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

MudBlazor Tree View display the edit view on the 1st click but all subsequent clicks only change the URL & does not update the view

$
0
0

As mentioned in the subject line the MudBlazor Tree View display the edit view on the 1st click but all subsequent clicks only change the URL & does not update the view. Please find the code snippet to the .razor file as well as the code behind.

Razor file snippet:

<MudTreeView Hover T="ClientTreeItem" ReadOnly Color="Color.Tertiary"><MudTreeViewItem Text="Client List" Expanded="true">        @foreach (var client in Model)        {<div @onclick="@(OpenContextMenu)" @oncontextmenu="@(OpenContextMenu)" @oncontextmenu:preventDefault @oncontextmenu:stopPropagation><MudTreeViewItem T="ClientTreeItem" Value="@CreateClientItem(client)" OnClick="@((e) => OnClientClick(client))" Text="@client.ClientName" Icon="@Icons.Material.Filled.Business" Expanded="false">                ....</div>        }</MudTreeViewItem></MudTreeView>

Code behind file snippet:

private void OnClientClick(ClientNavigationContextDto client){    // Check if the client exists    if (client == null)        return;    EditClient(client.ClientId);}private void EditClient(int clientId){    // Navigate to edit page by ID    NavigationManager.NavigateTo($"/clients/{clientId}");}

Output:

The on click of the client displays the edit view as expected!

![enter image description here

All subsequent clicks on the client Tree view item update the URL but not the view as seen below.

![enter image description here


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>