New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Barcode Export

Next database reset in 1 hours, 8 minutes, 7 seconds


Brand NameModelClassificationCar ImageBarcode
Page size:
 66 items in 14 pages
OpelCorsaHatchback Car Image
HondaCivicHatchback Car Image
AudiA3Hatchback Car Image
LanciaYpsilonHatchback Car Image
OpelCorsaHatchback Car Image

This example demonstrates how easily you could export RadBarcode to PDF. At the moment RadBarcode could be exported only to PDF and if it is placed in RadGrid. In order to export the grid content to PDF format simply use the ExportToPdf() server-side method. Please note that the OutputType of the control has to be set to EmbeddedPNG in order to be exported. In this example, RadBarcode is placed in TemlateColumn and contains link to Wikipedia with additional information related to the particular car.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Language="C#" Inherits="Telerik.Examples.Integration.BarcodeExport.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container">
        <telerik:RadButton RenderMode="Lightweight" Text="Export to PDF" runat="server" ID="Button1" OnClick="Button1_Click"
            Skin="Windows7">
        </telerik:RadButton>
        <br />
        <br />
        <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" AutoGenerateColumns="false" DataSourceID="SqlDataSource1"
            AllowPaging="true" PageSize="5" OnItemCreated="RadGrid1_ItemCreated" GridLines="None" Skin="Windows7">
            <ExportSettings OpenInNewWindow="true" IgnorePaging="true">
                <Pdf PageLeftMargin="20px" PageRightMargin="20px" PageTopMargin="20px" PageBottomMargin="20px" />
            </ExportSettings>
            <MasterTableView CommandItemDisplay="None" TableLayout="Fixed">
                <CommandItemSettings ShowExportToPdfButton="true" />
                <Columns>
                    <telerik:GridBoundColumn DataField="BrandName" HeaderText="Brand Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Model" HeaderText="Model">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Classification" HeaderText="Classification">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Car Image" UniqueName="CarImage">
                        <HeaderStyle Width="150px" />
                        <ItemTemplate>
                            <asp:Image ID="CarImage" runat="server" AlternateText="Car Image" ImageUrl='<%# GetCarImageUrl(Container) %>'
                                ImageAlign="Middle" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Barcode" UniqueName="Barcode">
                        <HeaderStyle Width="100px" />
                        <ItemTemplate>
                            <telerik:RadBarcode runat="server" ID="RadBarcode1" Type="QRCode" Width="66px" Height="66px"
                                OutputType="EmbeddedPNG" Text='<%# SetBarcodeUrl(Container) %>'>
                                <QRCodeSettings DotSize="2" Version="0" AutoIncreaseVersion="true" />
                            </telerik:RadBarcode>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Cars" runat="server"></asp:SqlDataSource>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance