Please help iam trying to use checkbox to tick out some items then print codes for them but when i click on one it ends up ticking all of them please help i would want print out only selected item please help
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master" CodeBehind="PrintCodesV2.aspx.vb" Inherits="PRINTCODES.PrintCodesV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table>
    <tr>
        <td>Name:<asp:TextBox ID="txtName" runat="server"></asp:TextBox></td>
    </tr>
    <tr>
        <td>Country:<asp:TextBox ID="txtCountry" runat="server"></asp:TextBox></td>
    </tr>
    <tr>
        <td><asp:Button ID="btnInsert" runat="server" Text="Insert" /></td>
    </tr>
</table>
<table class="auto-style1">
    <tr>
        <td class="auto-style7" colspan="2">Search items<asp:TextBox ID="txtSearch" runat="server" Width="183px"></asp:TextBox></td>
    </tr>
</table>
<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="False" CssClass="Grid">
    <Columns>
        <asp:BoundField HeaderText="Itemcode" DataField="Itemcode" />
        <asp:BoundField HeaderText="stockitem" DataField="Stockitem" />
        <asp:BoundField HeaderText="SalePrice" DataField="Saleprice" />
        <asp:TemplateField>
            <HeaderTemplate>Send Iterm</HeaderTemplate>
            <ItemTemplate>
                <asp:LinkButton ID="lnkSend" Text="Send" runat="server"></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <HeaderTemplate>
                <asp:CheckBox ID="chkAll" runat="server" AutoPostBack="true" />
            </HeaderTemplate>
            <ItemTemplate>
                <asp:CheckBox ID="chk" runat="server" AutoPostBack="true" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<table class="auto-style1">
    <tr>
        <td class="auto-style4">
            <asp:Button ID="Button2" runat="server" Text="Print" />
        </td>
        <td> </td>
    </tr>
    <tr>
        <td class="auto-style4"> </td>
        <td> </td>
    </tr>
</table>
<br />
<asp:Panel runat="server" ID="pnlDetails" Visible="false">
    <table>
        <tr>
            <td><asp:Label ID="lblName" runat="server" Text=""></asp:Label></td>
            <td><asp:Label ID="lblCountry" runat="server" Text=""></asp:Label></td>
            <td><asp:Image ID="imgBarCode" runat="server" /></td>
        </tr>
    </table>
</asp:Panel>
<br />
<div class="Pager"></div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.min.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="ASPSnippets_Pager.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        GetCustomers(1);
        $("body").on("keyup", "[id*=txtSearch]", function () {
            GetCustomers(parseInt(1));
        });
        $("body").on("click", ".Pager .page", function () {
            GetCustomers(parseInt($(this).attr('page')));
        });
    });
    function SearchTerm() {
        return jQuery.trim($("[id*=txtSearch]").val());
    };
    function GetCustomers(pageIndex) {
        $.ajax({
            type: "POST",
            url: "PrintCodesV2.aspx/GetCustomers",
            data: '{searchTerm: "' + SearchTerm() + '", pageIndex: ' + pageIndex + '}',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: OnSuccess,
            failure: function (response) {
                alert(response.d);
            },
            error: function (response) {
                alert(response.responseText);
            }
        });
    }
    var row;
    function OnSuccess(response) {
        var xmlDoc = $.parseXML(response.d);
        var xml = $(xmlDoc);
        var customers = xml.find("Customers");
        if (row == null) {
            row = $(".Grid tr:last-child").clone(true);
        }
        var footer = $(".Grid tr:last-child").clone(true);
        $(".Grid tr").not($(".Grid tr:first-child")).remove();
        if (customers.length > 0) {
            $.each(customers, function () {
                var customer = $(this);
                $("td", row).eq(0).html($(this).find("itemcode").text());
                $("td", row).eq(1).html($(this).find("stockitem").text());
                $("td", row).eq(2).html($(this).find("saleprice").text());
                $(".Grid").append(row);
                row = $(".Grid tr:last-child").clone(true);
            });
            $(".Grid").append(footer);
            var pager = xml.find("Pager");
            $(".Pager").ASPSnippets_Pager({
                ActiveCssClass: "current",
                PagerCssClass: "pager",
                PageIndex: parseInt(pager.find("PageIndex").text()),
                PageSize: parseInt(pager.find("PageSize").text()),
                RecordCount: parseInt(pager.find("RecordCount").text())
            });
            $(".Name").each(function () {
                var searchPattern = new RegExp('(' + SearchTerm() + ')', 'ig');
                $(this).html($(this).text().replace(searchPattern, "<span class = 'highlight'>" + SearchTerm() + "</span>"));
            });
        } else {
            var empty_row = row.clone(true);
            $("td:first-child", empty_row).attr("colspan", $("td", row).length);
            $("td:first-child", empty_row).attr("align", "center");
            $("td:first-child", empty_row).html("No records found for the search criteria.");
            $("td", empty_row).not($("td:first-child", empty_row)).remove();
            $(".Grid").append(empty_row);
        }
    };
</script>
</asp:Content>
 
Imports System.IO
Imports System.Drawing
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Public Class PrintCodesV2
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not Me.IsPostBack Then
            'Me.BindGrid()
            BindDummyRow()
            gvCustomers.DataBind()
        End If
    End Sub
    Private Sub BindDummyRow()
        Dim dummy As DataTable = New DataTable()
        dummy.Columns.Add("itemcode")
        dummy.Columns.Add("stockitem")
        dummy.Columns.Add("saleprice")
        dummy.Rows.Add()
        gvCustomers.DataSource = dummy
        gvCustomers.DataBind()
        'sample()
    End Sub
    <System.Web.Services.WebMethod()>
    Public Shared Function GetCustomers(ByVal searchTerm As String, ByVal pageIndex As Integer) As String
        Dim query As String = "[GetCustomers_Pager2022]"
        Dim cmd As SqlCommand = New SqlCommand(query)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@SearchTerm", searchTerm)
        cmd.Parameters.AddWithValue("@PageIndex", pageIndex)
        cmd.Parameters.AddWithValue("@PageSize", 15)
        cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4).Direction = ParameterDirection.Output
        Return GetData(cmd, pageIndex).GetXml()
    End Function
    Private Shared Function GetData(ByVal cmd As SqlCommand, ByVal pageIndex As Integer) As DataSet
        Dim strConnString As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
        Using con As SqlConnection = New SqlConnection(strConnString)
            Using sda As SqlDataAdapter = New SqlDataAdapter()
                cmd.Connection = con
                sda.SelectCommand = cmd
                Using ds As DataSet = New DataSet()
                    sda.Fill(ds, "Customers")
                    Dim dt As DataTable = New DataTable("Pager")
                    dt.Columns.Add("PageIndex")
                    dt.Columns.Add("PageSize")
                    dt.Columns.Add("RecordCount")
                    dt.Rows.Add()
                    dt.Rows(0)("PageIndex") = pageIndex
                    dt.Rows(0)("PageSize") = 15
                    dt.Rows(0)("RecordCount") = cmd.Parameters("@RecordCount").Value
                    ds.Tables.Add(dt)
                    Return ds
                End Using
            End Using
        End Using
    End Function
    Protected Sub chkAll_CheckedChanged(sender As Object, e As EventArgs)
        'Detmermine the state of the Header CheckBox.
        Dim isChecked As Boolean = TryCast(sender, CheckBox).Checked
        'Loop and check and uncheck all row CheckBoxes based on Header Cell CheckBox.
        For Each row As GridViewRow In gvCustomers.Rows
            TryCast(row.FindControl("chk"), CheckBox).Checked = isChecked
        Next
    End Sub
    Protected Sub chk_CheckedChanged(sender As Object, e As EventArgs)
        Dim isChecked As Boolean = True
        'Loop to verify whether all row CheckBoxes are checked or not.
        For Each row As GridViewRow In gvCustomers.Rows
            If Not TryCast(row.FindControl("chk"), CheckBox).Checked Then
                'If one CheckBox is found unchecked. Break.
                isChecked = False
                Exit For
            End If
        Next
        'Set the state of the Header CheckBox based on isChecked variable.
        Dim chkAll As CheckBox = TryCast(gvCustomers.HeaderRow.FindControl("chkAll"), CheckBox)
        chkAll.Checked = isChecked
    End Sub
End Class