如何在单击时打印多个条形码

时间:2014-06-25 14:22:29

标签: c# asp.net printing barcode

我想通过一次点击从gridview打印不同的条形码。我试过但它不起作用......它应该根据数量生成条形码......这是代码...... 这是我的带打印按钮的网格..

<div class="col-xs-1">
                                <asp:Button ID="btnprintbc" runat="server" Text="Print Barcode" class="width-65 pull-right btn btn-sm btn-success" OnClick="btnprintbc_Click" />
                            </div>
                            <div class="table-responsive">
                            <asp:GridView ID="gvrec" class="table table-striped table-bordered table-hover" AllowPaging="False" AllowSorting="True" AutoGenerateColumns="False" ShowHeader="true" DataKeyNames="nv_recid" EnableViewState="true" runat="server">
                                <Columns>
                                    <asp:BoundField DataField="nv_recid" HeaderText="S.NO" SortExpression="nv_recid" />
                                    <asp:TemplateField >
                                        <HeaderTemplate>
                                            <asp:TextBox ID="txtcc" placeholder="Search..." runat="server" class="nav-search-input" Width="210"></asp:TextBox>
                                            <asp:Button ID="btnSearch" runat="server" Text="Search" CommandName="Search" />
                                        </HeaderTemplate>
                                        </asp:TemplateField>
                                    <asp:BoundField DataField="nGRN" SortExpression="nGRN" HeaderText="GRN" />
                                    <asp:BoundField DataField="strVendorName" SortExpression="nGRN" HeaderText="Vendor Name" />
                                    <asp:TemplateField HeaderText="Bill NO">
                                        <ItemTemplate>
                                            <asp:Label ID="lblbn" runat="server" Text='<%# Eval("strBillNO") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="bnSKU" SortExpression="bnSKU" HeaderText="Barcode" />
                                    <asp:BoundField DataField="strDescription" SortExpression="strDescription" HeaderText="Description" />
                                    <asp:BoundField DataField="nQTY" SortExpression="nQTY" HeaderText="Quantity" />
                                    <asp:BoundField DataField="nCost" SortExpression="nCost" HeaderText="Cost Price" />
                                    <asp:BoundField DataField="nTotalCost" SortExpression="nTotalCost" HeaderText="Total Cost" />
                                    <asp:BoundField DataField="nRetail" SortExpression="nRetail" HeaderText="Retail Price" />
                                    <asp:BoundField DataField="nTotalRetail" SortExpression="nTotalRetail" HeaderText="Total Retail" />
                                    <asp:BoundField DataField="dtAddDate" SortExpression="dtAddDate" HeaderText="Date" />


                                </Columns>
                            </asp:GridView>

条形码打印代码就在这里......

lblsize.Text = Session["price"].ToString();
getCodetxt.Text = Session["SKU"].ToString();
int W = Convert.ToInt32("130");
int H = Convert.ToInt32("40");

b.IncludeLabel = true;
BarcodeLib.TYPE type = BarcodeLib.TYPE.CODE128C;

Bitmap btmap = (Bitmap)b.Encode(type, getCodetxt.Text.Trim(), System.Drawing.Color.Black, System.Drawing.Color.White, W, H);
btmap.Save(AppDomain.CurrentDomain.BaseDirectory + "/Attachments/BarCodes/" + getCodetxt.Text + ".jpeg", ImageFormat.Jpeg);
img.ImageUrl = "~/Attachments/BarCodes/" + getCodetxt.Text + ".jpeg";
Session["URL"] = "~/Attachments/BarCodes/" + getCodetxt.Text + ".jpeg";
Session["imageUrl"] = Session["URL"].ToString();
Session["Number"] = Session["val"];

如何根据网格中给出的数量生成不同的条形码?

0 个答案:

没有答案