Barcode HtmlHelper Overview

The Telerik UI Barcode HtmlHelper for ASP.NET Core is a server-side wrapper for the Kendo UI Barcode widget.

The Barcode represents data in a machine-readable format.

Initializing the Barcode

  1. Add the Barcode.

        @(Html.Kendo().Barcode()
          .Name("barcode") // The name of the Barcode is mandatory. It specifies the "id" attribute of the widget.
          .Value("2346722") // Set the value of the Barcode.
          .Width(200)
          .Height(100))
    
  2. Select the appropriate encoding (symbology) from the available options. Specify it through the encoding method which accepts an enum value.

      @(Html.Kendo().Barcode()
        .Name("mascarpone")
        .Value("Mascarpone")
        .Encoding(BarcodeSymbology.Code128)
        .Width(200)
        .Height(100))
    

Functionality and Features

The Barcode supports a set of encoding types.

Referencing Existing Instances

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

  // Place the following after the declaration of the Barcode for ASP.NET Core.
  <script>
  $(function() {
      // The Name() of the Barcode is used to get its client-side instance.
      var barcode = $("#barcode").data("kendoBarcode");
      barcode.value("foo") // Supply a valid value for that encoding. Then, the Barcode will redraw automatically.
  });
  </script>

See Also

In this article
Not finding the help you need? Improve this article