mvc

How to Show Barcode Reader in Table Format using MVC ?.

Introduction

 Bar code is a machine-readable code in the form of numbers and a pattern of parallel lines of varying widths, printed on a commodity and used especially for stock control. This tip introduces approaches to generate bar code in ASP.NET MVC project. Bar code has a unique pattern of parallel lines; this pattern represent a unique number. Using this number, we get information of product that has this bar code. 

create an ActionResult method named Index.

public ActionResult Index()

        {

            return View();

        }

Now create a view, right click on the Index action method and select Add View.

@model BarCode.Models.BarCodeModel

@{

    ViewBag.Title = “Index”;

}

<h2>Index</h2>

@using (Html.BeginForm())

{

    @Html.ValidationSummary(true)

    <fieldset>

        <legend>Add Product</legend>

        <div class=”editor-label”>

            @Html.LabelFor(model => model.Name)

        </div>

        <div class=”editor-field”>

            @Html.EditorFor(model => model.Name)

            @Html.ValidationMessageFor(model => model.Name)

        </div>

        <div class=”editor-label”>

            @Html.LabelFor(model => model.Description)

        </div>

        <div class=”editor-field”>

            @Html.EditorFor(model => model.Description)

            @Html.ValidationMessageFor(model => model.Description)

        </div>

        <p>

            <input type=”submit” value=”Create” />

        </p>

    </fieldset>

}

<div>

    @Html.ActionLink(“Back to List”, “Index”)</div>