Search results

Customize icon and width in ASP.NET Core DropDownButton control

02 Aug 2021 / 1 minute to read

Width of the DropDownButton can be customized by setting required width to the dropdown element.

The following UI can be achieved by setting iconPosition as Top, width as 85px and size of the font icon as 40px by adding e-custom class.

tagHelper
underline.cs
Copied to clipboard
<ejs-dropdownbutton id="ddbtn" items="ViewBag.items" content="Clipboard" beforeItemRender="itemRender"></ejs-dropdownbutton>

<script>
function itemRender(args){
    if (args.item.text === 'Copy') {
        // To underline a particular text.
        args.element.innerHTML = '<u>C</u>opy';
    }
}
</script>
Copied to clipboard
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Syncfusion.EJ2.Buttons;
namespace EJ2CoreSampleBrowser.Controllers.Button
{
    public partial class ButtonController : Controller
    {
        public ActionResult DropDownButton()
        {
            List<object> items = new List<object>();
            items.Add(new
            {
                text = "Cut"
            });
            items.Add(new
            {
                text = "Copy"
            });
            items.Add(new
            {
                text = "Paste"
            });
            ViewBag.items = items;
            return View();
        }
    }
}