Barcode HtmlHelper Overview

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

Configuration

  1. Add a Barcode.

    Example
        @(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. Choose the appropriate symbology (encoding) from the available options. Specify it through the encoding method which accepts an enum value.

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

Reference

Existing Instances

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

Example
  //Put this after your Kendo UI Barcode for ASP.NET Core declaration.
  <script>
  $(function() {
      //Notice that the Name() of the Barcode is used to get its client-side instance.
      var barcode = $("#barcode").data("kendoBarcode");
      barcode.value("foo") //make sure you supply valid value for that encoding then the barcode will redraw automatically
  });
  </script>

See Also

Other articles on Telerik UI for ASP.NET MVC and on the Barcode:

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