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.
The BarCode is part of Telerik UI for ASP.NET Core, a
professional grade UI library with 100+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
Initializing the Barcode
-
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))
-
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 client-side 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>