Edit this page

QRCode HtmlHelper Overview

The QRCode HtmlHelper extension is a server-side wrapper for the Kendo UI QRCode widget.

Configuration

Below are listed the steps for you to follow when configuring the Kendo UI QRCode.

  1. Make sure you followed all the steps from the introductory article on Telerik UI for ASP.NET MVC.

  2. Create a new action method which renders the view.

    Example
        public ActionResult Index()
        {
            return View();
        }
    
  3. Add a QRCode.

    Example
    
            <%: Html.Kendo().QRCode()
            .Name("qrcode") //The name of the QRCode is mandatory. It specifies the "id" attribute of the widget.
            .Value("#ff0000") //Set the value of the QRCode.
            %>
    
    
            @(Html.Kendo().QRCode()
                  .Name("qrcode") //The name of the QRCode is mandatory. It specifies the "id" attribute of the widget.
                  .Value("#ff0000") //Set the value of the QRCode.
            )
    
  4. Choose the appropriate correction level and/or encoding.

    Example
    
            <%: Html.Kendo().QRCode()
                    .Name("qrcode")
                    .ErrorCorrection(QRErrorCorrectionLevel.H)
                    .Encoding(QREncoding.ISO_8859_1)
                    .Value("foo")
            %>
    
    
            @(Html.Kendo().QRCode()
                  .Name("qrcode")
                  .ErrorCorrection(QRErrorCorrectionLevel.H)
                  .Encoding(QREncoding.ISO_8859_1)
                  .Value("foo")
            )
    

Reference

Existing Instances

To reference an existing Kendo UI QRCode instance, use the jQuery.data() configuration option. Once a reference is established, use the QRCode API to control its behavior.

Example
  //Put this after your Kendo QRCode for ASP.NET MVC declaration.
  <script>
  $(function() {
      //Notice that the Name() of the QRCode is used to get its client-side instance.
      var qrcode = $("#qrcode").data("kendoQRCode");
  });
  </script>

See Also