| [Server Side] // create the Ribbon Tab Element RibbonTab rbTab = new RibbonTab { Id = "Diagram", Text = "Háló" }; List<TabContent> buttons = new List<TabContent>(); // Creath the button element ButtonProperties bp = new ButtonProperties { ContentType = Syncfusion.JavaScript.ContentType.ImageOnly, PrefixIcon = "e-icon e-ribbon e-zoomin", Click = "ribbon_Click" }; TabContent tbc = new TabContent(); ContentGroup cgr = new ContentGroup(); //Bind the button settings cgr.ButtonSettings = bp; // Configure the button Element into Tab Content tbc.ContentGroups.Add(cgr); buttons.Add(tbc); // Add the tab to Tab Groups rbTab.TabGroups.Add(new TabGroup { AlignType = Syncfusion.JavaScript.RibbonAlignType.Columns, Content = buttons }); RibbonProperties rbn = new RibbonProperties(); // Bind the properits for Ribbon Element rbn.Width = "100%"; rbn.IsResponsive = true; rbn.RibbonTabs.Add(rbTab); return View(rbn); [Client Side] @model Syncfusion.JavaScript.Models.RibbonProperties @(Html.EJ().Ribbon("defaultRibbon",Model)) <script> //Click Event function ribbon_Click(args) { console.log("Zoom In Image Button Clicked"); } </script> |
| [Controller] ButtonProperties bp = new ButtonProperties { ContentType = Syncfusion.JavaScript.ContentType.ImageTextImage, PrefixIcon = "e-icon e-ribbon e-zoomin", Click = "ribbon_Click", Text="Zoom In" }; ButtonProperties bzoomout = new ButtonProperties { ContentType = Syncfusion.JavaScript.ContentType.TextAndImage, PrefixIcon = "e-icon e-ribbon e-zoomout", Click = "ribbon_Click", Text="Zoom Out" }; [Script] function ribbon_Click(args) { console.log(args.target.innerText + " Button Clicked"); } |