Barcode - Barcode Export

Next database reset in 1 hours, 10 minutes, 40 seconds


Brand NameModelClassificationCar ImageBarcode
Page size:
 56 items in 12 pages
OpelCorsaHatchback Car Image
HondaCivicHatchback Car Image
AudiA3Hatchback Car Image
LanciaYpsilonHatchback Car Image
OpelCorsaHatchback Car Image
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

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 PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<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

Help Us Improve

Was this example helpful?