How to Generate Barcodes in RDLC in ASP.NETEncoding, Adjusting &Printing Barcodes in RDLC Reports in ASP.NET Web Applications
KA.Barcode for RDLC Reports Details
KeepAutomation Barcode Generator for RDLC is a barcode generation library which is capable of adding dynamic barcode images in RDLC Reports. The RDLC Reports integrated in ASP.NET web applications are supported. This page goes through the system requirement of the generator. Installation and barcode generation guide with C#.NET &VB.NET sample codes is also presented. Compatibility & Requirements
- .NET Development Platforms: Visual Studio 2005/2008 /2010, .NET Version greater than 2.0, C#.NET & VB.NET
- Windows Systems: Windows 2000, XP, Vista, and Windows 7
- Least System Demands: 500 MHZ processor, 128 MB RAM, 5 MB available hard drive space
- Microsoft Windows XP
- Microsoft Visual Studio 2005
- Visual C#.NET
How to Generate Barcodes in RDLC in ASP.NET
Download Demo Package
Create A RDLC Report in Web Forms
- Create a web form project in your Visual Studio and add "KeepAutomation.Barcode.RDLC.dll" to project reference.
- Go to "Solution Explorer" and right click your project to add a new "Class" item named "BarcodeDemo".
- Copy the following demo code to your project.
- Click "Build" tab and choose "Build Web Site".
- Switch to "Solution Explorer" and right click your web project to add a new "Report" item.
- Drag a "Table" in "Report Items" under "Toolbox" to the report and insert "BarcodeName" and "BarcodeId" to the table columns.
- Go to "Toolbox" and insert "Image" item to the last column and name the column "Barcode".
- Revise "Source" to "Database", "MIMEType" to "image/jpeg", "Value" to "=Fields!Byte.Value" through "Properties" window.
- In "Solution Explorer", right click "Default.aspx" and select "View Designer" to add a "ReportViewer" to the project.
- Select your created report and run your web project.
C# Sample code
public class BarocdeDemo {
private string m_barcodeName; private int m_barcodeId; private byte[] m_byte; public BarocdeDemo(string barcodeName, int barcodeId, string data) { m_barcodeName = barcodeName; m_barcodeId = barcodeId; BarCode barcode = new BarCode(); barcode.Symbology = KeepAutomation.Barcode.Symbology.Code11; barcode.CodeToEncode = data; m_byte = barcode.generateBarcodeToByteArray(); } public byte[] Byte { get { return m_byte; } } public string BarcodeName { get { return m_barcodeName; } } public int BarcodeId { get { return m_barcodeId; } } } public class Merchant { private List<BarocdeDemo> m_barcodes; public Merchant() { m_barcodes = new List<BarocdeDemo>(); m_barcodes.Add(new BarocdeDemo("code11", 001, "code11")); m_barcodes.Add(new BarocdeDemo("code25", 002, "code25")); m_barcodes.Add(new BarocdeDemo("code39", 003, "code39")); m_barcodes.Add(new BarocdeDemo("code93", 004, "code93")); m_barcodes.Add(new BarocdeDemo("code128",005, "code128")); m_barcodes.Add(new BarocdeDemo("upcean", 006, "upcean")); } public List<BarocdeDemo> GetProducts() { return m_barcodes; } } VB Sample code
Public Class BarocdeDemo
Private m_barcodeName As String Private m_barcodeId As Integer Private m_byte As Byte() Public Sub New(barcodeName As String, barcodeId As Integer, data As String) m_barcodeName = barcodeName m_barcodeId = barcodeId Dim barcode As New BarCode() barcode.Symbology = KeepAutomation.Barcode.Symbology.Code39 barcode.CodeToEncode = data m_byte = barcode.generateBarcodeToByteArray() End Sub Public ReadOnly Property [Byte]() As Byte() Get Return m_byte End Get End Property Public ReadOnly Property BarcodeName() As String Get Return m_barcodeName End Get End Property Public ReadOnly Property BarcodeId() As Integer Get Return m_barcodeId End Get End Property End Class Public Class Merchant Private m_barcodes As List(Of BarocdeDemo) Public Sub New() m_barcodes = New List(Of BarocdeDemo)() m_barcodes.Add(New BarocdeDemo("code11", 1, "code11")) m_barcodes.Add(New BarocdeDemo("code25", 2, "code25")) m_barcodes.Add(New BarocdeDemo("code39", 3, "code39")) m_barcodes.Add(New BarocdeDemo("code93", 4, "code93")) m_barcodes.Add(New BarocdeDemo("code128", 5, "code128")) m_barcodes.Add(New BarocdeDemo("upcean", 6, "upcean")) End Sub Public Function GetProducts() As List(Of BarocdeDemo) Return m_barcodes End Function End Class |
CompatibilityTest EnvironmentWeb RDLC Reports How To Start Using C#Using VB.NETUsing ASP.NETUsing .NET WinformsData Matrix for RDLCPDF417 for RDLCQR Code for RDLCmoreCodabar for RDLCCode 39 for RDLCCode 128 for RDLCEAN-8 for RDLCEAN-13 for RDLCEAN 128 for RDLCIntelligent Mail for RDLCInterleaved 2 of 5 for RDLCISBN for RDLCITF-14 for RDLCRM4SCC for RDLCUPC-A for RDLCUPC-E for RDLCmore
|