TX Barcode .NET can be used in ASP.NET web applications to render barcode images. This sample shows how to use a WebForms Image control to render a barcode image that is created code-behind.

Rendering barcode objects in ASP.NET

The ASPX page is very simple and consists of a WebForms Image control, a label to show the raw text and a refresh button:

Loading...

In the Page_Load event, the current date and time measured in ticks is passed as a QueryString to the ImageUrl property of the Image control. The URL is another ASPX page that uses TX Barcode .NET to create the barcode image.

Loading...

In the Page_Load event of CreateBarcode.aspx, TX Barcode .NET is used to save the encoded string as a barcode image into a MemoryStream. This stream is returned using Response.BinaryWrite.

Loading...

The HTML image element loads the image data dynamically from the CreateBarcode.aspx page. Every time, the Refresh button is clicked, the barcode is updated with the current date and time.

Download the sample from GitHub and test it on your own.

GitHub

Download and Fork This Sample on GitHub

We proudly host our sample code on GitHub.com/TextControl.

Please fork and contribute.

Requirements for This Sample

  • Visual Studio 2012 or better
  • TX Text Control .NET Server for ASP.NET (trial sufficient)