☰
Current Page
Main Menu
Home
Home
Editing Custom-Export-Buttons
Edit
Preview
H1
H2
H3
default
Set your preferred keybinding
default
vim
emacs
markdown
Set this page's format to
AsciiDoc
Creole
Markdown
MediaWiki
Org-mode
Plain Text
RDoc
Textile
Rendering unavailable for
BibTeX
Pod
reStructuredText
Help 1
Help 1
Help 1
Help 2
Help 3
Help 4
Help 5
Help 6
Help 7
Help 8
Autosaved text is available. Click the button to restore it.
Restore Text
#Creating a Custom Export Button [[_TOC_]] ##Method This code sample will allow you to place your own export buttons wherever you need them on your report viewer. This button uses our built-in PDF icon and is set to export to pdf. However, you can change but the **"src"** and **"&output=pdf"** properties to match whatever image and export type you wish to use, respectively. ```csharp <img src="rs.aspx?image=pdf.gif" onclick="window.location='<%=string.Format("{0}? {1}&output=pdf",Request.ServerVariables["PATH_INFO"],Request.ServerVariables"QUERY_STRING"])%>'" ``` ##C♯ Sample This code sample will allow you to use the Izenda API to generate custom export capabilities with a standard webforms page. ```csharp using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using Izenda.AdHoc; using Izenda.AdHoc.Database; public partial class Export : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { foreach(string ds in AdHocContext.Driver.DatabaseSchema.Tables.AllKeys) { DataSourcesDD.Items.Add(ds); } } protected void DSButton_Click(object sender, EventArgs e) { foreach (Column column in AdHocContext.Driver.DatabaseSchema.Tables [DataSourcesDD.SelectedItem.Value].Columns.AllValues) { ListItem li = new ListItem(); li.Text = column.Name; li.Value = column.SqlName; li.Selected = true; FieldCBL.Items.Add(li); } } protected void ExportButton_Click(object sender, EventArgs e) { ReportSet rs = new ReportSet(); JoinedTable jt = new JoinedTable(); jt.TableName = DataSourcesDD.SelectedItem.Value; rs.JoinedTables.Add(jt); foreach (ListItem li in FieldCBL.Items) { if (!li.Selected) continue; Field f = new Field(li.Value); rs.Detail.Fields.Add(f); } AdHocContext.CurrentReportSet = rs; Response.Redirect("rs.aspx?output=csv"); } } ``` ```html <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Default.master" CodeFile="Export.aspx.cs" Inherits="Export" %> <asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolder" runat="Server"> <div class="page"> <form id="form1" runat="server"> <div> <asp:DropDownList ID="DataSourcesDD" runat="server"> </asp:DropDownList> <asp:Button ID="DSButton" runat="server" Text="OK" OnClick="DSButton_Click" /> <asp:CheckBoxList ID="FieldCBL" runat="server" RepeatColumns="5"> </asp:CheckBoxList> </div> <asp:Button ID="ExportButton" runat="server" Text="Export" OnClick="ExportButton_Click" /> </form> </div> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="TrackerPlaceHolder" runat="Server"> </asp:Content> ```
Uploading file...
Header
 **This documentation is for the legacy Izenda 6 product. Documentation for the new Izenda 7 product can be found at [[https://www.izenda.com/docs/|https://www.izenda.com/docs/]]**
Sidebar
 --- * [[Izenda 7 Series Documentation|https://www.izenda.com/docs/]] * [[Release Notes]] * [[Upgrade Best Practices|FAQ/Izenda-Update-Best-Practices]] * [[FAQ]] * [[Tutorials]] * [[The Izenda API|/API/AdHocConfig]] * [[The AdHocSettings class|/API/AdHocSettings]] * [Developer Links and Guides](/Guides/Developer-Links-and-Guides) * [[Known Issues]] --- * <a href="http://www.izenda.com" rel="nofollow" target="_blank">Izenda Website</a> * [Product Video](https://www.youtube.com/watch?v=X3-yWFq0w5A) * <a href="http://www.izenda.com/blog" rel="nofollow" target="_blank">Izenda Blog</a> * <a href="http://www.izenda.com/company/" rel="nofollow" target="_blank">About Us</a> * <a href="http://www.izenda.com/contact-us/" rel="nofollow" target="_blank">Contact Us</a> --- * [Guide To Report Design](/Guides/ReportDesign) * [Making Custom Forms Video](http://www.youtube.com/watch?v=5b2axJlgdFs) --- * [[Acknowledgements]]
Edit message:
Cancel