【Stimulsoft Reports.Net教程】查看器工具栏上的自定义按钮

本文主要介绍了Stimulsoft报表中如何在Web查看器的工具栏上添加自定义按钮。

【下载Stimulsoft Reports.Net最新版本】

此示例项目演示了如何在Web查看器的工具栏上添加自定义按钮。您可以设置自定义按钮的标题和图标,并添加单击事件。 例如,在工具栏上添加自定义按钮并定义单击事件,在其中显示警报消息。

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"    Inherits="Custom_Button_on_the_Toolbar_of_the_Viewer.Default" %><%@ Register assembly="Stimulsoft.Report.Web" namespace="Stimulsoft.Report.Web" tagprefix="cc1" %><!DOCTYPE html><html ><head runat="server">    <title>Custom Button on the Toolbar of the Viewer</title></head><body>    <form id="form1" runat="server">        <cc1:StiWebViewer ID="StiWebViewer1" runat="server"                OnGetReport="StiWebViewer1_GetReport" />    </form>    <script type="text/javascript">        ...    </script></body></html>

要添加按钮,您可以使用简单的JavaScript代码。首先,使用位于Web查看器对象中的SmallButton()构造函数创建自定义按钮对象。接下来,获取工具栏按钮容器并插入按钮对象。

var customButton = jsStiWebViewer1.SmallButton("customButton", "Custom Button", "emptyImage");customButton.image.src = "https://www.stimulsoft.com/favicon.png";customButton.action = function () {    alert("Custom Button Event");}var toolbarTable = jsStiWebViewer1.controls.toolbar.firstChild.firstChild;var buttonsTable = toolbarTable.rows[0].firstChild.firstChild;var customButtonCell = buttonsTable.rows[0].insertCell(0);customButtonCell.appendChild(customButton);

示例代码的结果如下图所示:

Stimulsoft

下载示例

购买Stimulsoft正版授权,请点击“咨询在线客服”哟!

FastReport2018.4

标签:报表解决方案报表.NETASP.NET报表控件报表设计stimulsoft report .netStimulsoft

来源:慧都网

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2018年8月25日
下一篇 2018年8月25日

相关推荐

发表回复

登录后才能评论