Menu Bar Data Binding

Hello. If in your example "Blazor Menu Bar Example - Data Binding" add ItemSelected event:

<SfMenu Items="@MenuItems">

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

</SfMenu>

working with the menu causes an error "Error: No Interop Methods Are Registered for Rendereer 1"


3 Replies

SS Sivakumar ShunmugaSundaram Syncfusion Team August 18, 2025 06:31 AM UTC

Hi Davron Karimov,

We have thoroughly tested the scenario you described using the "Blazor Menu Bar Example - Data Binding" with the ItemSelected event implementation. Based on our validation, the functionality works correctly without encountering the "Error: No Interop Methods Are Registered for Renderer 1" error you mentioned.

Our Test Results:

  • Syncfusion Version Tested: 30.2.5
  • Status: ItemSelected event works properly with data-bound menu items
  • Documentation References:

Sample: Attached as zip.

To help us better understand and resolve your specific issue, could you please provide:

  • Syncfusion Package Version: What version are you currently using?
  • Complete Code Sample: Can you share your full implementation including the data binding logic?
  • Project Configuration: Are you using Server-side Blazor, WebAssembly?
  • Error Details: Can you share the complete error stack trace?
  • Browser Console Logs: Any additional console errors or warnings?

Potential Solutions to Try:

  • Update Package: Ensure you're using the latest Syncfusion Blazor package (30.2.5 or newer)
  • Check TValue Type: Verify that your TValue matches your menu item model type
  • Validate Data Structure: Ensure your menu data structure aligns with the expected format

We're committed to helping you resolve this issue. Once you provide the additional details, we can offer a more targeted solution.

Regards,

Sivakumar S


Attachment: sample_363aae6e.zip


DK Davron Karimov August 18, 2025 12:01 PM UTC

Clear. I propose to simplify the code.


@page "/"

@using Syncfusion.Blazor.Navigations
<SfMenu Items="@MenuHierarchy">
    <MenuFieldSettings Text="Text" Children="SubMenu"></MenuFieldSettings>
    <MenuEvents TValue="CustomMenuItem" ItemSelected="ItemSelected"></MenuEvents>
</SfMenu>

<div>@selectedItem</div>
@code {
    string selectedItem;
    public List<CustomMenuItem> MenuHierarchy;

    protected override void OnInitialized()
    {
        MenuHierarchy = [
            new()
            {
                Text = "Events", SubMenu = [
                    new() { Text = "Conferences" },
                    new() { Text = "Music", SubMenu=[
                        new() { Text = "Pop" },
                        new() { Text = "Folk" },
                        new() { Text = "Classical" },
                    ] },
                    new () { Text = "Workshops" }
            ]},
            new()
            {
                Text = "Movies", SubMenu = [
                new () { Text = "Now Showing" },
                new () { Text = "Coming Soon" },
            ]},
            new()
            {
                Text = "Directory", SubMenu = [
                new () { Text = "Media Gallery" },
                new () { Text = "Newsletters" },
            ]},
            new()
            {
                Text = "Queries", SubMenu = [
                new () { Text = "Our Policy" },
                new () { Text = "Site Map" },
            ]},
            new() { Text = "Services" },
            new() { Text = "Conferences" },
        ];
    }

    public class CustomMenuItem
    {
        public string Text { get; set; }
        public string ImageName { get; set; }
        public bool IsSeparator { get; set; }
        public List<CustomMenuItem> SubMenu { get; set; }
    }

    private void ItemSelected(MenuEventArgs<CustomMenuItem> args)
{
        //Selected menu item
var selectedItem = args.Item.Text;
    }
}


LD LeoLavanya Dhanaraj Syncfusion Team August 19, 2025 11:14 AM UTC

Hi Davron,


Thank you for sharing your updated code. From the details provided, we understand that you have resolved the mentioned issue and met your needs. Please feel free to reach out to us if you need any further assistance or if you encounter any issues. We will be happy to assist you.


Regards,

Leo Lavanya Dhanaraj


Loader.
Up arrow icon