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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Menu element on the right of the menu

Thread ID:

Created:

Updated:

Platform:

Replies:

121137 Nov 13,2015 08:43 AM UTC Nov 16,2015 04:19 PM UTC ASP.NET MVC 1
loading
Tags: Menu
Carlo
Asked On November 13, 2015 08:43 AM UTC

Greetings. I have the following requirement: add a menu element to the syncfusion MVC menu so that this element is docked to the right of the menu (while all the others are normally docked on the left). Is it possible to met this requirement without passing the whole menu as a JSON as explained in this howto? 

https://www.syncfusion.com/kb/3008/how-to-apply-url-htmlattribute-imageurl-linkattribute-for-menu-items

At the moment the menu is created directly in the _layout.cshtml file with the following razor syntax:

@Html.EJ().Menu("mainMenu").Items(items => {

                            items.Add().Url(Url.Action("Index", "Home")).Text("Home").Children(child =>
                                {                                  
                                        child.Add().Url(Url.Action("LogOff", "Account")).Text("Log Off");                                                                 
                                        child.Add().Url(Url.Action("LogOn", "Account")).Text("Log On");
                                    
                                });
                            items.Add().Url(Url.Action("Index", "ChiamataManutenzione")).Text("Apri chiamata");
                            items.Add().Url(Url.Action("Index", "ListaOdM")).Text("Lista OdM");
                            items.Add().Url("#").Text("Anagrafiche").Children(child =>
                            {
                                child.Add().Url(Url.Action("Index", "AnagraficaTipologiaManutenzione")).Text("Tipologie interventi");
                                    
                                child.Add().Url(Url.Action("Index", "AnagraficaCapannoni")).Text("Capannoni");
                                child.Add().Url(Url.Action("Index", "AnagraficaMacchine")).Text("Macchine");
                            });
                   }).EnableSeparator(false)



Gobalakrishnan S [Syncfusion]
Replied On November 16, 2015 04:19 PM UTC

Hi Carlo,

Thanks for contacting Syncfusion support.

Yes we can achieve your requirement, without passing the menu as JSON. We can use the “insert” method in menu to add the menu items dynamically from client side. Please refer the following code,


<script>

    function onsubmitClick() {

        //Object for menu item created

        var obj = $("#mainMenu").ejMenu("instance");

        //Use "insert" method to add the menu items dyncamically

        obj.insert([{ id: 19, text: "Group A", htmlAttribute: { "class": "myclass" }}]);

    }

</script>



      <style type="text/css" class="cssStyles">

        .myclass{

            float:right;

        }

      </style>


We have attached a sample for your reference, please check it.

Samplelocation http://www.syncfusion.com/downloads/support/forum/121137/ze/SyncfusionMvcApplication1-872460121

Regards,

Gobalakrishnan S


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

;