Barcode printing using DataList in ASP.Net

Barcode printing using DataList in ASP.Net



Description
This code is use to Print Database values as Barcode. Generally, when we want to print price then it requires to print it in Barcode form. It uses when have to handling some products database or some bying/selling/ goods databases. It should be place (*) starts and ends of price to read barcode. It has to be used in below code
Note: Convert Font-Names as 3 of 9 Barcode

First Download attached Barcode Font

Add below code in HTML page


<asp:datalist id="Datalist1" runat="server" BorderWidth="1">
<ItemTemplate>
<asp:Label id="Lbladd" runat="server" Text='<% #DataBinder.Eval(Container.Dataitem,"Name")%>'></asp:Label>
</br>
<asp:Label id="Label1" runat="server" Font-Names="3 of 9 Barcode" text='<% #DAtaBinder.Eval

(Container.DataItem,"Price")%>'></asp:Label>
</ItemTemplate>
</asp:datalist>


Add NameSpaces


Imports System
Imports System.Data
Imports System.Data.SqlClient


Add Connection String

Dim con As New SqlConnection("initial catalog=DatabaseName;Data source=ServerName; User id=sa")


Add below code on Page Load

Dim com As New SqlCommand("Select top 10 Titlefield, pricefield from TableName", con)
Dim ada As New SqlDataAdapter(com)
Dim dset As New DataSet
ada.Fill(dset)

Dim dt As New DataTable
Dim dc As New DataColumn
dc = New DataColumn("Name")
dset.Tables(0).Columns.Add(dc)
dc = New DataColumn("Price")
dset.Tables(0).Columns.Add(dc)

For i As Integer = 0 To dset.Tables(0).Rows.Count - 1
dset.Tables(0).Rows(i)("Name") = dset.Tables(0).Rows(i)("Titlefield")
dset.Tables(0).Rows(i)("Price") = "*" & dset.Tables(0).Rows(i)("pricefield") & "*"
Next

Datalist1.DataSource = dset
Datalist1.DataBind()

End If


Thanks
Nilesh Jadhav


Attachments

  • 3 of 9 Barcode (35291-82326-3OF9_NEW.rar)
  • Comments

    No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: