Popup items
11 Apr 202222 minutes to read
Icons
The popup action item has an icon or image to provide visual representation of the action. To place the icon on a popup item, set the iconCss
property to e-icons
with the required icon CSS. By default, the icon is positioned to the left side of the popup action item.
In the following sample, the icons for edit, delete, mark as read and like message menu items are added using the iconCss property.
@Html.EJS().DropDownButton("left-icon").Content("Message").Items((IEnumerable<object>)ViewBag.items).IconCss("ddb-icons e-message").Render()
<style>
/* csslint ignore:start */
@@font-face {
font-family: 'e-db-icons';
src:
url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj0jSRoAAAEoAAAAVmNtYXDnFudgAAABkAAAADpnbHlmSrKTCAAAAdgAAAC4aGVhZBKtK8cAAADQAAAANmhoZWEHmQNtAAAArAAAACRobXR4D7gAAAAAAYAAAAAQbG9jYQB4ADoAAAHMAAAACm1heHABEAAYAAABCAAAACBuYW1lH00mDAAAApAAAAJJcG9zdIwkSr0AAATcAAAATQABAAADUv9qAFoEAAAA//4D6gABAAAAAAAAAAAAAAAAAAAABAABAAAAAQAAGc/PS18PPPUACwPoAAAAANfSc3wAAAAA19JzfAAAAAAD6gPqAAAACAACAAAAAAAAAAEAAAAEAAwAAgAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQPuAZAABQAAAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA5wPnBQNS/2oAWgPqAJYAAAABAAAAAAAABAAAAAPoAAAD6AAAA+gAAAAAAAIAAAADAAAAFAADAAEAAAAUAAQAJgAAAAQABAABAADnBf//AADnA///AAAAAQAEAAAAAQACAAMAAAAAAAAAHAA6AFwAAAACAAAAAAPqA2UABgAKAAA3IREjCQEjBRcBIQID6AL+Dv4NAQEY3QG4/I+IAsL+GAHonroBcwAAAAIAAAAAA8YD6gAFAAoAADchESMJASUHCQImA6AD/jL+MQEEywGWAZb+agICX/4+AcLXsv6cAWQBZAAAAAEAAAAAA+oD6gALAAATCQEXCQE3CQEnCQECATP+zcIBMgEzwf7OATLB/s3+zgMp/s3+zsIBM/7NwgEyATPB/s4BMgAAAAASAN4AAQAAAAAAAAABAAAAAQAAAAAAAQAKAAEAAQAAAAAAAgAHAAsAAQAAAAAAAwAKABIAAQAAAAAABAAKABwAAQAAAAAABQALACYAAQAAAAAABgAKADEAAQAAAAAACgAsADsAAQAAAAAACwASAGcAAwABBAkAAAACAHkAAwABBAkAAQAUAHsAAwABBAkAAgAOAI8AAwABBAkAAwAUAJ0AAwABBAkABAAUALEAAwABBAkABQAWAMUAAwABBAkABgAUANsAAwABBAkACgBYAO8AAwABBAkACwAkAUcgZS1kYi1pY29uc1JlZ3VsYXJlLWRiLWljb25zZS1kYi1pY29uc1ZlcnNpb24gMS4wZS1kYi1pY29uc0ZvbnQgZ2VuZXJhdGVkIHVzaW5nIFN5bmNmdXNpb24gTWV0cm8gU3R1ZGlvd3d3LnN5bmNmdXNpb24uY29tACAAZQAtAGQAYgAtAGkAYwBvAG4AcwBSAGUAZwB1AGwAYQByAGUALQBkAGIALQBpAGMAbwBuAHMAZQAtAGQAYgAtAGkAYwBvAG4AcwBWAGUAcgBzAGkAbwBuACAAMQAuADAAZQAtAGQAYgAtAGkAYwBvAG4AcwBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIAB1AHMAaQBuAGcAIABTAHkAbgBjAGYAdQBzAGkAbwBuACAATQBlAHQAcgBvACAAUwB0AHUAZABpAG8AdwB3AHcALgBzAHkAbgBjAGYAdQBzAGkAbwBuAC4AYwBvAG0AAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAQIBAwEEAQUADG1lc3NhZ2UtbWFpbAtyZWFkLXVucmVhZAZkZWxldGUAAAAAAA==) format('truetype');
font-weight: normal;
font-style: normal;
}
/* csslint ignore:stop */
.ddb-icons {
font-family: 'e-db-icons' !important;
speak: none;
font-size: 55px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.e-message::before {
content: '\e703';
}
.e-edit::before {
content: '\ea9a';
}
.e-delete::before {
content: '\e705';
}
.e-read::before {
content: '\e704';
}
.e-like::before {
content: '\e81a';
}
button {
margin: 25px 5px 20px 20px;
}
</style>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace WebApplication1.Controllers
{
public class DropDownButtonController : Controller
{
public ActionResult PopupIcons()
{
List<object> items = new List<object>();
items.Add(new
{
text = "Edit",
iconCss = "ddb-icons e-edit"
});
items.Add(new
{
text = "Delete",
iconCss = "ddb-icons e-delete"
});
items.Add(new
{
text = "Mark as Read",
iconCss = "ddb-icons e-read"
});
items.Add(new
{
text = "Like Message",
iconCss = "e-icons e-like"
});
ViewBag.items = items;
return View();
}
}
}
Navigations
Actions in DropDownButton can be used to navigate to the other web page when action item is clicked. This can be achieved by Popup items that can be customized using the beforeItemRender
event. The item render event providing link to the action item using url
property.
In the following sample, navigation URL for Flipkart, Amazon, and Snapdeal action items are added using the url
property:
@Html.EJS().DropDownButton("navigation").Content("Shop By").Items((IEnumerable<object>)ViewBag.items).IconCss("e-cart-icon e-link").BeforeItemRender("beforeItemRender").Render()
<script>
function beforeItemRender(args) {
args.element.getElementsByTagName('a')[0].setAttribute('target', '_blank');
}
</script>
<style>
/* csslint ignore:start */
@@font-face {
font-family: 'cart';
src:
url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj0gSQ4AAAEoAAAAVmNtYXDnEOdVAAABiAAAADZnbHlmGatngwAAAcgAAADYaGVhZBKtP4wAAADQAAAANmhoZWEHmQNpAAAArAAAACRobXR4B+j//gAAAYAAAAAIbG9jYQBsAAAAAAHAAAAABm1heHABDwBQAAABCAAAACBuYW1lfiv21QAAAqAAAAIBcG9zdIZzcJAAAASkAAAAOgABAAADUv9qAFoEAP/+//wD7AABAAAAAAAAAAAAAAAAAAAA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cgB0AGMAYQByAHQAVgBlAHIAcwBpAG8AbgAgADEALgAwAGMAYQByAHQARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAdQBzAGkAbgBnACAAUwB5AG4AYwBmAHUAcwBpAG8AbgAgAE0AZQB0AHIAbwAgAFMAdAB1AGQAaQBvAHcAdwB3AC4AcwB5AG4AYwBmAHUAcwBpAG8AbgAuAGMAbwBtAAAAAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgECAQMAEHNob3BwaW5nLWNhcnQtMDUAAAAA) format('truetype');
font-weight: normal;
font-style: normal;
}
/* csslint ignore:stop */
.e-cart-icon {
font-family: 'cart' !important;
speak: none;
font-size: 55px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.e-link::before {
content: '\e700';
}
button {
margin: 25px 5px 20px 20px;
}
</style>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace WebApplication1.Controllers
{
public class DropDownButtonController : Controller
{
public ActionResult Navigation()
{
List<object> items = new List<object>();
items.Add(new
{
text = "Flipkart",
iconCss = "e-cart-icon e-link",
url = "https://www.google.co.in/search?q=flipkart"
});
items.Add(new
{
text = "Amazon",
iconCss = "e-cart-icon e-link",
url = "https://www.google.co.in/search?q=amazon"
});
items.Add(new
{
text = "Snapdeal",
iconCss = "e-cart-icon e-link",
url = "https://www.google.co.in/search?q=snapdeal"
});
ViewBag.items = items;
return View();
}
}
}
Template
Item templating
Popup items can be customized using the beforeItemRender
event. The item render event triggers while rendering each popup action item. The event argument will be used to identify the action item and customize based on the requirement.
In the following example, the icons in each li items is right aligned by appending span element in li rendering:
@Html.EJS().DropDownButton("item-template").Items((IEnumerable<object>)ViewBag.items).IconCss("e-ddb-icons e-paste").BeforeItemRender("beforeItemRender").Render()
<script>
function beforeItemRender(args) {
if (args.item.text === 'Edit') {
args.element.innerHTML = '<span></span><div><b>Paste Text</b><div>Provides option to paste only the<br>selected text.</div></div>';
args.element.style.height = '80px';
var span = args.element.children[0];
span.setAttribute('class', 'e-cm-icons e-pastetext e-align');
var div = args.element.children[1];
div.setAttribute('class', 'e-div-align');
} else {
args.element.innerHTML = '<span></span><div><b>Paste Special</b><div>Provides options to paste formulas,<br> values, comments, validations etc...</div></div>';
args.element.style.height = '80px';
var span = args.element.children[0];
span.setAttribute('class', 'e-cm-icons e-pastespecial e-align');
var div = args.element.children[1];
div.setAttribute('class', 'e-div-align');
}
}
</script>
<style>
/* csslint ignore:start */
@@font-face {
font-family: 'e-context-menu';
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMjjNRVMAAAEoAAAAVmNtYXDicOK6AAABjAAAADhnbHlmGcEPFQAAAcwAAAMwaGVhZA69CA8AAADQAAAANmhoZWEH9AQEAAAArAAAACRobXR4DAAAAAAAAYAAAAAMbG9jYQDYAZgAAAHEAAAACG1heHABEgDAAAABCAAAACBuYW1lxY1d1QAABPwAAAKFcG9zdPJwcMoAAAeEAAAASAABAAAEAAAAAFwEAAAAAAADlwABAAAAAAAAAAAAAAAAAAAAAwABAAAAAQAAgmhm8l8PPPUACwQAAAAAANYD4Y8AAAAA1gPhjwAAAAADlwP0AAAACAACAAAAAAAAAAEAAAADALQABQAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQQAAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA4mDiYQQAAAAAXAQAAAAAAAABAAAAAAAABAAAAAQAAAAEAAAAAAAAAgAAAAMAAAAUAAMAAQAAABQABAAkAAAABAAEAAEAAOJh//8AAOJg//8AAAABAAQAAAABAAIAAAAAANgBmAAFAAAAAAOXA/QABAAlAC0ATgCzAAABIScHJzcVHwc/By8HDwYBFSE1MxEhESUHFQ8GLwc/Bx8GJysBDw4RHw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AAAAAAAEAA8AJgABAAAAAAAFAAsANQABAAAAAAAGAA8AQAABAAAAAAAKACwATwABAAAAAAALABIAewADAAEECQAAAAIAjQADAAEECQABAB4AjwADAAEECQACAA4ArQADAAEECQADAB4AuwADAAEECQAEAB4A2QADAAEECQAFABYA9wADAAEECQAGAB4BDQADAAEECQAKAFgBKwADAAEECQALACQBgyBDb250ZXh0TWVudSAoMilSZWd1bGFyQ29udGV4dE1lbnUgKDIpQ29udGV4dE1lbnUgKDIpVmVyc2lvbiAxLjBDb250ZXh0TWVudSAoMilGb250IGdlbmVyYXRlZCB1c2luZyBTeW5jZnVzaW9uIE1ldHJvIFN0dWRpb3d3dy5zeW5jZnVzaW9uLmNvbQAgAEMAbwBuAHQAZQB4AHQATQBlAG4AdQAgACgAMgApAFIAZQBnAHUAbABhAHIAQwBvAG4AdABlAHgAdABNAGUAbgB1ACAAKAAyACkAQwBvAG4AdABlAHgAdABNAGUAbgB1ACAAKAAyACkAVgBlAHIAcwBpAG8AbgAgADEALgAwAEMAbwBuAHQAZQB4AHQATQBlAG4AdQAgACgAMgApAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAHUAcwBpAG4AZwAgAFMAeQBuAGMAZgB1AHMAaQBvAG4AIABNAGUAdAByAG8AIABTAHQAdQBkAGkAbwB3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBAgEDAQQAD01UX1Bhc3RlU3BlY2lhbAxNVF9QYXN0ZVRleHQAAA==) format('truetype');
font-weight: normal;
font-style: normal;
}
/* csslint ignore:stop */
.e-cm-icons {
font-family: 'e-context-menu';
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1;
text-transform: none;
}
@@font-face {
font-family: 'ddb-icons';
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj0gSRkAAAEoAAAAVmNtYXDnE+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3V0CHBhc3RlXzAxBGZvbnQOcGFyYS1tYXJrLS0tMDMAAA==) format('truetype');
font-weight: normal;
font-style: normal;
}
.e-ddb-icons {
font-family: 'ddb-icons' !important;
speak: none;
font-size: 55px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.e-pastespecial::before {
content: '\e260';
}
.e-pastetext::before {
content: '\e261';
}
.e-paste::before {
content: '\e701';
}
button {
margin: 25px 5px 20px 20px;
}
.e-dropdown-popup ul {
max-width: 400px;
white-space: nowrap;
}
.e-align {
float: left;
width: 15%;
margin-top: 15px;
font-size: 45px;
color: grey;
}
.e-div-align {
float: right;
width: 75%;
line-height: 23px;
margin: 0 15px 0 0;
}
</style>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace WebApplication1.Controllers
{
public class DropDownButtonController : Controller
{
public ActionResult ItemTemplate()
{
List<object> items = new List<object>();
items.Add(new
{
text = "Edit"
});
items.Add(new
{
text = "Cut"
});
ViewBag.items = items;
return View();
}
}
}
Popup Templating
The whole popup can be customized as per the requirement. In the following example, the popup can be customized by handling it in target
property.
<div id="target" style='border: 1px solid grey;'>
<table class="e-popup-table">
<caption class="e-caption" style='height: 18px; background-color: #e0e0e0;'><b>Insert Table</b></caption>
<tr class='e-row'>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
</tr>
<tr class='e-row'>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
</tr>
<tr class='e-row'>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
</tr>
<tr class='e-row'>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
</tr>
<tr class='e-row'>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
</tr>
<tr class='e-row'>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
<td class='e-data'></td>
</tr>
</table>
</div>
@Html.EJS().DropDownButton("element").Content("Table").Target("#target").IconCss("e-icons e-table").Render()
<style>
.shortcut {
float: right;
margin-top: 9px;
padding-left: 30px;
height: 100px;
}
.e-popup-table {
border-collapse: separate;
}
.e-data {
border: 1px solid grey;
padding: 8px;
}
.e-table::before {
content: '\e705';
}
.e-row {
padding-left: 3px;
padding-right: 3px;
}
.e-caption {
caption-side: top;
padding: 0 0 0 18px;
}
button {
margin: 25px 5px 20px 20px;
}
</style>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace WebApplication1.Controllers
{
public class DropDownButtonController : Controller
{
public ActionResult PopupTemplate()
{
return View();
}
}
}