Java Barcode Generator, .NET Barcode Generator for C#, ASP.NET, VB.NET
HOME BARCODE FOR .NET RDLC PURCHASE

How to Create Barcodes for RDLC Reports in ASP.NET Web Forms



Quick Navigate





1. 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

2. Create Barcode Image in RDLC Reports for ASP.NET Web Forms
  • Create a new ASP.NET Web Application Project.
    1. Create a new "ASP.NET Web Site" project, named "BarcodeforRDLCReports".


  • Add a new Class to the project and Add Reference.
    1. Add a new item (Class), named "SampleClass.cs" to the project. view image
    2. Add "BarcodeLib.Barcode.RDLCReports.dll" to the project reference.
    3. Add the following sample code to your created class "APP_Code/SampleClass.cs".
      using System.Collections.Generic;
      using BarcodeLib.Barcode.RDLCReports;
      using BarcodeLib.Barcode;
      
    4. Add the following sample code to your created class "APP_Code/SampleClass.cs".
      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;
          }
      }
      
    5. In Visual Studio menu bar, choose "Build Web Site" from "Build" tab. view image


  • Add a new Report to the web form.
    1. Add a new report (Report), named "RDLCReports.rdlc" to the project. view image
    2. In Report Items from Toolbox, insert a "Table" to the report. view image
    3. 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
    4. In "Toolbox", drag an "Image" item to the last column "Barcode". view image
    5. Set image properties "MIMEType" to "image/jpeg", "Source" to "Database", and "Value" to "=Fields!Barcode.Value".
      Save the report. view image


  • Add a Report Viewer to the web form.
    1. In "Solution Explorer", right-click "Default.aspx", and select "View Designer".
    2. In "Toolbox", add "ReportViewer" to the web form project, with the default setting unchanged. view image
    3. In "ReportViewer Tasks" window, choose your created report "RDLCReports.rdlc". view image


  • Resize the "ReportViewer", and run the project.


 

3. Property Settings for Each Barcode Types











   Copyright BarcodeLib.com. All rights reserved.