QRCode for ASP.NET Web Forms
Business Card QRCode
User Scenarios > Business Card QRCode

Another use of the QRCode can be to store information added to the contact us page or a business card. This eliminates the need, for application users, to type or save the contact details manually. They can retrieve the details by simply scanning the code with their smartphone.

In Visual Studio, create a new ASP.Net Web Application and add a new Web Form. Then, complete the following steps:

In the Designer

  1. Place six labels onto the Web Form and set their properties, as shown below:

    Control Name Property Value
    Label1 Text Smith Anderson
    Label2 Text ComponentOne
    Label3 Text Address: 203 New York Ave, New York, USA
    Label4 Text Ph: 1.800.858.2739
    Label5 Text Fax: 1.800.858.2739
    Label6 Text Email: Smith@componentone.com

    The form will appear somewhat as shown in the image below:

  2. Locate the C1QRCode control in the toolbox and place it onto the Web Form.
    If you cannot locate the control in the toolbox, right click and select Choose items. The Choose Toolbox Items dialog appears. Locate the control and click OK.

In Source View

Following will be your code for the form, in the Source View, after you have added all controls and set all the properties:

Source View
Copy Code
<b> <asp:Label ID="Label1" runat="server" Text="Smith Anderson"></asp:Label></b>
<p>
    <asp:Label ID="Label2" runat="server" Text="ComponentOne"></asp:Label><br />
    <asp:Label ID="Label3" runat="server" Text="Address:  203 New York Ave, New York, USA"></asp:Label><br />
    <asp:Label ID="Label4" runat="server" Text=" Ph: 1.800.858.2739"></asp:Label><br />
    <asp:Label ID="Label5" runat="server" Text=" Fax: 1.800.858.2739"></asp:Label><br />
    <asp:Label ID="Label6" runat="server" Text="Email: Smith@componentone.com"></asp:Label><br />
</p>
<cc1:C1QRCode ID="C1QRCode1" runat="server" />

In Code

Add the following code to the Page_Load  event, to generate the QRCode for the labels added to the form.

C#
Copy Code
C1QRCode1.Text = Label1.Text + '\n' + Label2.Text + '\n' + Label3.Text + 
    '\n' + Label4.Text + '\n' + Label5.Text + '\n' + Label6.Text;
VB
Copy Code
C1QRCode1.Text = Label1.Text + ControlChars.Lf + Label2.Text + ControlChars.Lf +
    Label3.Text + ControlChars.Lf + Label4.Text + ControlChars.Lf + Label5.Text +
    ControlChars.Lf + Label6.Text

What You've Accomplished

When you run the project, a QRCode containing the details of the business card is generated, as shown below:

When you scan the above QRCode, the reader will decode the following information:

Smith Anderson
ComponentOne
Address: 203 New York Ave, New York, USA
Ph: 1.800.858.2739
Fax: 1.800.858.2739
Email: Smith@componentone.com