Blazor Context Menu not opening on click

I have a blazor context menu that I'm triggering with an onclick actions:


Context Menu;

<SfContextMenu @ref="ContextMenuFromButton" Target="#OrdersViewContextMenu" TValue="MenuItem" Items="MenuItemsFromButton">

    <MenuEvents TValue="MenuItem" ItemSelected="ContextMenuItemClickedFromButton"></MenuEvents>

</SfContextMenu>


Button;


<button id="OrdersViewContextMenu" class="btn btn-sm btn-secondary" @onclick="((args) => ContextMenuOpenFromButton(args, _order.parentId))">

    <em class="fa fa-ellipsis-h"></em>

</button>



And my Action;


public async Task ContextMenuOpenFromButton(MouseEventArgs e, Guid id)

{

try

{

await ContextMenuOpenHandler(id); // Sets the Context Menu Items

ContextMenuFromButton.Open(e.ClientX, e.ClientY);

StateHasChanged(); // Needs to be before Grid Refresh

}

catch (Exception ex)

{

var x = ex;

}

}



However, the Context Menu doesn't open, giving a System.ObjectDisposedException for the ScopedServices of the Context Menu (See Image). How do I get the Contest Menu to Open?



Attachment: 20220324_141652_858396ae.zip


1 Reply

TS Thaneegairaj Sankar Syncfusion Team March 28, 2022 10:37 AM UTC

Hi Zachary, 
 
We have prepared a sample based on the given code snippet and we can able to open the context menu using button click. Please find the below sample link, 
 
 
Please check the above details and if you are still facing issue, please share the below details. 
 
·         If possible, Share the issue reproducible sample or replicate the issue in above sample
·         Share the full Context Menu related code snippet. 
·         Share us your Essential studio product version. 
 
Please provide the above requested information, based on that we will check and provide you a better solution quickly. 
 
Regards, 
Thaneegairaj S 


Loader.
Up arrow icon