【下载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正版授权,请点击“咨询在线客服”哟!

标签: 表解决方案 表.NETASP.NET 表控件 表设计stimulsoft report .netStimulsoft
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!