This tutorial covers how you can display BarCodes in Report header.
In Visual Studio, you cannot use a custom control in headers or footers. Since, Aspose.BarCode for Reporting Services is a control, you cannot just drag and drop the control to the header for displaying the barcode. But, the good news is that you can use images in report header and footer. In this tutorial, we will show how you can use image control to render BarCode image using Aspose.BarCode for Reporting Services.
Create a Report Server project in Visual Studio 2005.
Add a new “Shared Data Source”. In this example, we will use “AdventureWorks” database.
Add a new blank report to the project. Create a new “DataSet” for the report. Give the following SQL query in the “Query String” text area.
Select ProductID, Name, ProductNumber From Product
Click on “OK” button to save this dataset.
Now, we will add an image control to the report header. To view the header, switch to “Layout” view of the report and from the menu, select “Report” à “Page Header”. From the Visual Studio toolbox, drag an Image control to the header. Select “Database” as the “Image Source”. 
Press “Next” to go on next screen. In DataSet dropdown, select the dataset that you just created for the report. Select “ProductNumber” for the “Image field”. We will use this ProductNumber column as a CodeText to generate the BarCode. In MIME type, select “image/bmp”.
Press “Finish” to end the “image add” wizard.
After this, add a reference to the Aspose.BarCode.ReportingServices.dll. Select “Report” à “Report Properties” and click on the “References” tab. Browse the Aspose.BarCode.ReportingServices.dll and add it to the references. In “Classes” tab, add the description for the class as follows:
Class Name: Aspose.BarCode.ReportingServices.BarCodeBuilder
Instance Name: objBarCode
Now, click on the “Code” tab and add the following code.
Public Function GetBarCodeImage(ByVal codetext As String) As Byte()
objBarcode.CodeText = codetext
objBarcode.xDimension = 0.1
objBarcode.SymbologyType = Aspose.BarCode.ReportingServices.Symbology.Code39Standard
return objBarcode.GetBarCodeImage()
End Function
Click on “OK” to save the reference, class details and the code.
So far, we have added the image and the code to generate the BarCode.
Click on “View” à “DataSets” and drag the “ProductNumber” and “Name” columns to the report body. Also add 2 textboxes to the body for the purpose of adding labels. The Report layout should look as follows:
Now right click on the image control and select “Properties”. Set the value as “=Code.GetBarCodeImage(ReportItems!ProductNumber.Value)”
Save all the files and click on “Preview” tab. You should see the similar output as below:
If you cannot see the BarCode, please click on the “Print Layout” icon on the toolbar. This will show the report with the header and footer.