This topic demonstrates, with code examples, how to add the igQRCodeBarcode™ control to an HTML page.
The following topics are prerequisites to understanding this topic:
igQRCodeBarcode control including its main features and minimum requirements.This topic contains the following sections:
To add igQRCodeBarcode control to a web page requires an HTML element, a <div> to serve as the base for instantiation. The basic configuration of igQRCodeBarcode requires providing a value for the data option (to feed the control with the data to display) along with setting values for its width and height.
The following table summarizes the requirements for using the igQRCodeBarcode control.
| Required Resources | Description | What you need to do… | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| jQuery and jQuery UI JavaScript resources | Ignite UI for jQuery™ is built on top of the following frameworks: |
Add script references to both libraries in the <head> section of your page.
|
||||||||||||||
General igQRCodeBarcode JavaScript Resources
|
The igQRCodeBarcode control depends on functionality distributed across several files in the Ignite UI for jQuery Library. You can load the required resources in one of the following ways:
igLoader or
the combined files.
|
Add one of the following:
|
Following are the general conceptual steps for adding igQRCodeBarcode to an HTML Page.
Creating the target element for storing the igQRCodeBarcode control
Instantiating the igQRCodeBarcode control
Configuring the basic rendering options
This procedure adds an instance of igQRCodeBarcode to an HTML page and configures its basic options - data, width and height. The string data to encode is http://www.infragistics.com. The procedure presumes the required resources are added to the header of the HTML page, so it instantiates the igQRCodeBarcode control in the document ready event to prevent any errors due to DOM being not fully loaded.
The following screenshot is a preview of the result.

To complete the procedure, you need the required JavaScript and CSS files referenced on the HTML page.
In HTML:
<!DOCTYPE html>
<html>
<head>
<!-- Ignite UI for jQuery CSS File -->
<link href="../../igniteui/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui.js"></script>
<!-- Ignite UI for jQuery Required Common JavaScript Files -->
<script src="../../igniteui/js/modules/infragistics.util.js"></script>
<script src="../../igniteui/js/modules/infragistics.util.jquery.js"></script>
<script src="../../igniteui/js/modules/infragistics.dv_core.js"></script>
<script src="../../igniteui/js/modules/infragistics.dv_jquerydom.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_core.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_collection.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_collectionsextended.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_text.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_ui.js"></script>
<!-- QR Code Barcode Specific JavaScript Files -->
<script src="../../igniteui/js/modules/encoding/infragistics.encoding.core.js"></script>
<script src="../../igniteui/js/modules/infragistics.barcode_qrcodebarcode.js"></script>
<script src="../../igniteui/js/modules/infragistics.ui.widget.js"></script>
<script src="../../igniteui/js/modules/infragistics.ui.barcode.js"></script>
</head>
<body>
</body>
</html>
Follow these steps to add an igQRCodeBarcode to an HTML page.
Create the target element for storing the igQRCodeBarcode control.
Create a <div> element within the HTML body on which to instantiate the igQRCodeBarcode control.
In HTML:
<body>
<!-- Target element for the igQRCodeBarcode -->
<div id="barcode"></div>
</body>
Instantiate the igQRCodeBarcode control.
Use the selector of the target element defined in step 1 to instantiate the igQRCodeBarcode control.
In HTML:
<script type="text/jscript">
$(function () {
$("#barcode").igQRCodeBarcode({
});
});
</script>
Configure the basic rendering options.
When instantiating the igQRCodeBarcode, configure the data, width, and height options.
In HTML:
$("#barcode").igQRCodeBarcode({
width: "200px",
height: "200px",
data: "http://www.infragistics.com"
});
Following is the full code for this procedure.
In HTML:
<!DOCTYPE html>
<html>
<head>
<!-- Ignite UI for jQuery CSS File -->
<link href="../../igniteui/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui.js"></script>
<!-- Ignite UI for jQuery Required Common JavaScript Files -->
<script src="../../igniteui/js/modules/infragistics.util.js"></script>
<script src="../../igniteui/js/modules/infragistics.util.jquery.js"></script>
<script src="../../igniteui/js/modules/infragistics.dv_core.js"></script>
<script src="../../igniteui/js/modules/infragistics.dv_jquerydom.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_core.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_collection.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_collectionsextended.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_text.js"></script>
<script src="../../igniteui/js/modules/infragistics.ext_ui.js"></script>
<!-- QR Code Barcode Specific JavaScript Files -->
<script src="../../igniteui/js/modules/encoding/infragistics.encoding.core.js"></script>
<script src="../../igniteui/js/modules/infragistics.barcode_qrcodebarcode.js"></script>
<script src="../../igniteui/js/modules/infragistics.ui.widget.js"></script>
<script src="../../igniteui/js/modules/infragistics.ui.barcode.js"></script>
<script type="text/jscript">
$(function () {
$("#barcode").igQRCodeBarcode({
width: "200px",
height: "200px",
data: "http://www.infragistics.com"
});
});
</script>
</head>
<body>
<div id="barcode"></div>
</body>
</html>
The following topics provide additional information related to this topic.
Adding igQRCodeBarcode to an ASP.NET MVC Application: This topic demonstrates, with code examples, how to add the igQRCodeBarcode control to an ASP.NET MVC View using the Ignite UI for MVC.
jQuery and MVC API Links (igQRCodeBarcode): This topic provides links to the API reference documentation about the igQRCodeBarcode control and the ASP.NET MVC Helper for it.
The following sample provides additional information related to this topic.
igQRCodeBarcode control.View on GitHub