The quick start guides you through the steps of adding different barcodes to your MVC web application and display them as the output. In the following example, we have added three barcodes, namely Codabar, Code39 and Gs1-128, and these barcodes can be displayed using the Codabar, Code39 and Gs1_128 barcode classes respectively. Similarly, you can use any of the 26 barcodes supported by the Barcode control. For the complete list of supported barcodes, see Barcode Encodings.
To accomplish this, follow these steps:
Create a new MVC application using the ComponentOne or VisualStudio templates. For more information about creating an MVC application, see Configuring your MVC Application topic.
To add the Barcode control to your application, add C1.Web.MVC reference and follow these steps:
BarcodeController
).Sale.cs |
Copy Code
|
---|---|
public IActionResult Index() { return View(); } |
BarcodeController.
Index()
.Index.cshtml |
Copy Code
|
---|---|
@model object[] <table class="table"> <thead> <tr> <th>BarCodes</th> </tr> </thead> <tbody> <tr> <td> <div> <div style="font-weight:bold">Codabar</div> <div><c1-codabar value="A15126893B" auto-width-zoom="2"></c1-codabar></div> </div> <br /> <div> <div style="font-weight:bold">Code39</div> <div><c1-code39 value="A1312BCV" auto-width-zoom="2"></c1-code39></div> </div> <br /> <div> <div style="font-weight:bold">Gs1_128</div> <div><c1-gs1_128 value="GS1128Demo" auto-width-zoom="2"></c1-gs1_128></div> </div> </td> </tr> </tbody> </table> |