Search results

Template Configuration

The Toolbar can be rendered by item based collection and by HTML elements. To render it based on the given HTML element, use id as the target property. To render the Toolbar, follow the below structure of the HTML elements:

  <div id='template_toolbar'>   --> Root Toolbar Element
    <div>      --> Toolbar Items Container
       <div>   --> Toolbar Item Element
       </div>
    </div>
  </div>

Here, the template ID, #template_toolbar is directly appended to the Toolbar.

tagHelper
template.cs
@section ControlsSection{
    <div class="col-lg-12 control-section">
        <div class="e-sample-resize-container">
            <div id='template_toolbar'>
                <div>
                    <div><button class='e-btn e-tbar-btn'>Cut</button> </div>
                    <div><button class='e-btn e-tbar-btn'>Copy</button> </div>
                    <div><button class='e-btn e-tbar-btn'>Paste</button> </div>
                    <div class='e-separator'> </div>
                    <div><button class='e-btn e-tbar-btn'>Bold</button> </div>
                    <div><button class='e-btn e-tbar-btn'>Italic</button> </div>
                </div>
            </div>
        </div>
    </div>
}

@section Scripts {
    <script type="text/javascript">
        var toolbarObj = new ej.navigations.Toolbar({ });
        toolbarObj.appendTo('#template_toolbar');
    </script>
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Syncfusion.EJ2.Toolbar;

// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace EJ2CoreSampleBrowser.Controllers
{
    public partial class ToolbarController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
        public IActionResult DefaultFunctionalities()
        {
            return View();
        }
    }
}

Popup is one of the supported responsive modes of the Toolbar. The Toolbar commands, popup mode priority and button text mode customizations are achieved in the item based rendering through property declaration. For more information on popup mode, refer here

The above behavior can also be achieved with template rendering by defining equivalent class names instead of property declaration.

Equivalent class names listed below are needed to add the Toolbar items’ div element.

Priority

Class Description
e-overflow-show Commands are always displayed on the Toolbar with primary priority.
e-overflow-hide Commands are always displayed in the popup with secondary priority.

Button text mode

Class Description
e-popup-text Button text is only visible in the Popup.
e-toolbar-text Button text is only visible on the Toolbar.
tagHelper
buttontext.cs
@section ControlsSection{
    <div class="col-lg-12 control-section">
        <div class="e-sample-resize-container">
            <div id='template_toolbar'>
                <div>
                    <div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-cut-icon e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Cut</div></button> </div>
                    <div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-copy-icon e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Copy</div></button> </div>
                    <div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-paste-icon e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Paste</div></button> </div>
                    <div class='e-separator'> </div>
                    <div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-bold-icon e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Bold</div></button> </div>
                    <div class='e-overflow-hide e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-underline-icon e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Underline</div></button> </div>
                    <div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-italic-icon e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Italic</div></button> </div>
                    <div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-ascending-icon e-icons e-btn-icon"></span><div class="e-tbar-btn-text">A-Z Sort</div></button> </div>
                    <div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-descending-icon e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Z-A Sort</div></button> </div>
                </div>
            </div>
        </div>
    </div>
}

@section Scripts {
    <script type="text/javascript">
        var toolbarObj = new ej.navigations.Toolbar({ width: 300, overflowMode: "Popup"});
        toolbarObj.appendTo('#template_toolbar');
    </script>
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Syncfusion.EJ2.Navigations;

// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace EJ2CoreSampleBrowser.Controllers
{
    public partial class ToolbarController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
        public IActionResult DefaultFunctionalities()
        {
            return View();
        }
    }
}