How can I add custom icon in Syncfusion ASP.NET ReportViewer toolbar?
Syncfusion ASP.NET ReportViewer allows you to add or modify an icon to customize the standard toolbar. The following code snippet illustrates how to add the Mail icon to the ReportViewer toolbar container using the template and CSS style.
<form id="form1" runat="server" onsubmit="return false" style="overflow: hidden; padding:0; margin: 0;height:100%;width:100%;"> <ej:ReportViewer ID="ReportViewer1" runat="server" OnClientReportLoaded="reportLoaded" ReportPath="~/App_Data/GroupingAgg.rdl" ProcessingMode="Remote"/> </form> <script type="text/javascript"> var viewerID = "ReportViewer1"; function reportLoaded(senderObj) { var $ulContainer = $("#" + viewerID + "_toolbarContainer "); $divouter = ej.buildTag("ul.e-reportviewer-toolbarul e-ul e-horizontal ", "", {}, {}); var $lifil = ej.buildTag("li.e-reportviewer-toolbarli e-tooltxt", "", { 'display': 'inline-block', }, { 'id': viewerID + '_toolbar_fil', 'title': 'Mail' }); var $spanfil = ej.buildTag("span.e-icon e-mail e-reportviewer-icon", "", {}, { 'id': viewerID + '_toolbar_fil' }); $divouter.append($lifil); $lifil.append($spanfil); $ulContainer.append($divouter); $lifil.hover(function () { $lifil.addClass("e-hover"); }, function () { $lifil.removeClass("e-hover"); }); $divouter.click(function (e) { alert('Action Triggered'); }); } </script>
Add the following CSS code example inside the <style> tag in Default.aspx.
<style> .e-reportviewer * { -webkit-box-sizing: content-box !important; -moz-box-sizing: content-box !important; box-sizing: content-box !important; } .e-mail { width: 20px; height: 20px; margin-top: 1px; } </style>
Run the application, the additional custom icon is added to the ReportViewer toolbar as shown in the following output snap.
Download the custom icon toolbar sample from here.
Note
A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.
The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.
You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!