We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

URL action submenu

Thread ID:

Created:

Updated:

Platform:

Replies:

131654 Jul 21,2017 09:27 AM UTC Jul 24,2017 12:27 PM UTC ASP.NET Core 1
loading
Tags: Menu
nax123
Asked On July 21, 2017 09:27 AM UTC

Hi,
I have a problem with menu  - URL is not generated when menu  items are generated in foreach process. Am I missing something? same syntax works when adding individual items and other  properties in foreach process are also generated ok.

        public async Task<IViewComponentResult> InvokeAsync()
        {
            List<MenuItem> mainMenu = new List<MenuItem>();
           mainMenu.Add(new MenuItem
            {
                Id = 200,
                Text = "MasterData",
                ParentId = null,
                URL =Url.Action("Index", "MasterData")
            ,
          
            mainMenu.Add(new MenuItem { Id = 300, Text = "Main", ParentId = null, URL =Url.Action("Index", "Main") }); -THIS WORKS
     mainMenu.Add(new MenuItem { Id = 301, Text = "MainOther", ParentId = null, URL =Url.Action("Index", "Main", new{actionID=1}) }); - THIS WORKS
            mainMenu.Add(new MenuItem { Id = 400, Text = "Functions", ParentId = null, URL = "" });
            var functions = GetFunctions(null);
           
            foreach (Function function in functions)
            {
                mainMenu.Add(new MenuItem
                {
                    Id = function.ID,
                    Text = function.Name,
                    ParentId = 400,
                    URL = Url.Action("ExecuteAction", "Main", new { actionID =function.ID }) THIS  IS EMPTY
                }
                            );
            }
            return View(mainMenu);
        }

Prince Oliver [Syncfusion]
Replied On July 24, 2017 12:27 PM UTC

Hi Rein, 

Thank you for contacting Syncfusion support. 

We tried to recreate your scenario using the code snippet you provided, but we were unable to reproduce the issue you reported. We have attached the sample for your reference, kindly refer to the following link for the sample: http://www.syncfusion.com/downloads/support/forum/131654/ze/MenuCoreSample1319094655 

If the issue still persists in your end, please provide us an issue reproducible sample or modify the above sample to reproduce the issue. it will help us provide you solution. 

Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;