Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET RDLC Reports Barcode > .NET, C#, VB.NET Barcode Library for RDLC Reports for ASP.NET
Download Barcode for RDLC Reports Trial

How to Create Barcodes with RDLC Reports for ASP.NET Web Form Applications

Prerequisites
  • BarcodeLib.Barcode.RDLCReports.dll
  • Microsoft .NET Framework 2.0 (or later)
  • SQL Server 2005 (any edition) with AdventureWorks Database installed
  • Microsoft Visual Studio 2005 or later version
Create Barcode Image in RDLC Reports for ASP.NET Web Forms
  1. Create a new ASP.NET Web Application Project.
    • Create a new "ASP.NET Web Site" project, named "BarcodeforRDLCReports".
  2. Add a new Class to the project and Add Reference.
    • Add a new item (Class), named "SampleClass.cs" to the project. view image
    • Add "BarcodeLib.Barcode.RDLCReports.dll" to the project reference.
    • Add the following sample code to your created class "APP_Code/SampleClass.cs".
    • In Visual Studio menu bar, choose "Build Web Site" from "Build" tab. view image
     using System.Collections.Generic;
using BarcodeLib.Barcode.RDLCReports;
using BarcodeLib.Barcode;


public class SampleClass
{
private string m_description;
private int m_price;
private byte[] m_bytes;

public SampleClass(string description, int price, string data)
{
m_description = description;
m_price = price;
LinearRDLC barcode = new LinearRDLC();
barcode.Type = BarcodeType.CODE128;
barcode.Data = data;
m_bytes = barcode.drawBarcodeAsBytes();
}

public byte[] Bytes
{
get { return m_bytes; }
}

public string Description
{
get
{
return m_description;
}
}

public int Price
{
get
{
return m_price;
}
}
}

public class Merchant
{
private List<SampleClass> m_products;

public Merchant()
{
m_products = new List<SampleClass>();
m_products.Add(new SampleClass("code128", 25, "code128"));
m_products.Add(new SampleClass("code39", 30, "code39"));
m_products.Add(new SampleClass("qrcode", 15, "qrcode"));
}

public List<SampleClass> GetProducts()
{
return m_products;
}
}
3. Add a new Report to the web form.
  • Add a new report (Report), named "RDLCReports.rdlc" to the project. view image
  • In Report Items from Toolbox, insert a "Table" to the report. view image
  • In "Website Data Sour...", add "Name" and "Price" to first two columns of the report table details section.
    Name the last column "Barcode". view image
  • In "Toolbox", drag an "Image" item to the last column "Barcode". view image
  • Set image properties "MIMEType" to "image/jpeg", "Source" to "Database", and "Value" to "=Fields!Barcode.Value".
    Save the report. view image
4. Add a Report Viewer to the web form.
  • In "Solution Explorer", right-click "Default.aspx", and select "View Designer".
  • In "Toolbox", add "ReportViewer" to the web form project, with the default setting unchanged. view image
  • In "ReportViewer Tasks" window, choose your created report "RDLCReports.rdlc". view image
5. Resize the "ReportViewer", and run the project.

Other .NET Barcode Generator Components