protected void ButtonPrint_Barcode_Click(object sender, EventArgs e)
    {
        string barcode = "";
        //barcode = ((Button)sender).CommandArgument.ToString();
        GridViewRow row          = (GridViewRow)(((Button)sender).NamingContainer);
        Label       barcodelabel = (Label)row.FindControl("BookBarcode");

        barcode = barcodelabel.Text;
        //Barcode generation test
        if (barcode != "")
        {
            MyBarcodeGenerator.Generate(barcode);
            DataTable dt = new DataTable();
            dt.Columns.Add("name");
            DataRow dr = dt.NewRow();
            dr["name"] = barcode + ".jpg";
            dt.Rows.Add(dr);
            DataListbookbarcode.Enabled    = true;
            DataListbookbarcode.DataSource = dt;
            DataListbookbarcode.DataBind();
            BindDataTogvResult();
            // Button buttonprint = (Button)row.FindControl("Button2");
            //ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>doPrint();</script>");
            //Response.Write("<script>alert('" + barcode + "')</script>");
            //var barcodeImage = MyBarcodeGenerator.Generate(barcode) as System.Drawing.Image;
            //MyBarcodeGenerator.ShowBarcode(barcode, this.Response);
        }
        else
        {
            Response.Write("<script>alert('Error!')<script/>");
        }
    }
    protected void ButtonPrint_Click(object sender, EventArgs e)
    {
        string      to_barcode   = "";
        GridViewRow row          = (GridViewRow)(((Button)sender).NamingContainer);
        Label       barcodelabel = (Label)row.FindControl("BookBarcode");

        to_barcode = barcodelabel.Text;
        if (to_barcode != "")
        {
            DataListbookbarcode.Enabled    = false;
            DataListbookbarcode.DataSource = null;
            DataListbookbarcode.DataBind();
            BindDataTogvResult();
            MyBarcodeGenerator.Generate(to_barcode);
            Session["info_barcode"] = to_barcode;
            Response.AddHeader("Refresh", "0");
            Response.Redirect("BarcodePrint.aspx");
            return;
        }
    }