protected void view_Click(object sender, EventArgs e)
    {
        if ((Convert.ToInt32(txtFrom.Text.Trim())) > (Convert.ToInt32(txtTo.Text.Trim())))
        {
            message("FromNo should be greater than ToNo");
            txtFrom.Focus();
        }
        else
        {
            //pnlCust.Visible = false;
            // PnlCustDiscDetails.Visible = false;
            //UpanelGrd.Visible = true;

            string ECode = txtEMcode.Text.ToString().Split(':')[0].Trim();
            //txtempcode.Text = ECode;
            int FromNo = Convert.ToInt32(txtFrom.Text);

            int     ToNo = Convert.ToInt32(txtTo.Text);
            DataSet ds   = new DataSet();
            ds = ReciptBookDetails.Get_Multiplecanceldetails(ECode, FromNo, ToNo);
            if (ds.Tables[0].Columns.Count > 1)
            {
                gvMultipleCancel.DataSource = ds;
                gvMultipleCancel.DataBind();
                btn_Save.Visible         = true;
                gvMultipleCancel.Visible = true;
            }
            else
            {
                message("Record not found between entered Receipt no.");
            }
            // Pnlmultiplecancel.Visible = true;
            //  gvMultipleCancel.Visible = true;
            //  btn_Save.Visible = true;
        }
        // message("Select Correct allocation Ranges Receipt No");
    }
    protected void btn_Save_Click1(object sender, EventArgs e)
    {
        if (Session["UserName"] != null)
        {
            string ECode = txtEMcode.Text.ToString().Split(':')[0].Trim();
            //txtempcode.Text = ECode;
            int FromNo = Convert.ToInt32(txtFrom.Text);

            int     ToNo = Convert.ToInt32(txtTo.Text);
            DataSet ds   = new DataSet();
            ds = ReciptBookDetails.Get_Multiplecanceldetails(ECode, FromNo, ToNo);
            if (ds.Tables[0].Columns.Count > 1 & redio.SelectedIndex == 0)
            {
                ReciptCancelBook reccan = new ReciptCancelBook();
                reccan.AutoCancelRecNo = Convert.ToInt32("0");
                reccan.EmpCode         = txtEMcode.Text.Trim();
                reccan.FromNo          = Convert.ToInt32(txtFrom.Text.Trim());
                reccan.ToNo            = Convert.ToInt32(txtFrom.Text.Trim());
                reccan.Resion          = txtResion.Text.Trim();

                reccan.CreatedBy = Session["UserName"].ToString();
                reccan.Save();
                message("Record Saved Successfully");

                //pnlCust.Visible = true;
                //PnlCustDiscDetails.Visible = true;
                //UpanelGrd.Visible = false;
                txtEMcode.Text = "";
                txtFrom.Text   = "";
                txtTo.Text     = "";
                txtResion.Text = "";
                gvMultipleCancel.DataSource = null;
                gvMultipleCancel.DataBind();
                multipal.Update();
                //btn_Save.Visible = false;
            }

            else
            {
                if (gvMultipleCancel.Rows.Count > 0)
                {
                    Label    lblReceiptNo = null;
                    TextBox  txtReasonGrd = null;
                    CheckBox chkSelect    = null;
                    foreach (GridViewRow row in gvMultipleCancel.Rows)
                    {
                        lblReceiptNo = (Label)row.FindControl("lblFromNo");
                        txtReasonGrd = (TextBox)row.FindControl("remarktext");
                        chkSelect    = (CheckBox)row.FindControl("check");
                        if (chkSelect.Checked == true)
                        {
                            if (lblReceiptNo.Text != "")
                            {
                                ReciptCancelBook reccan = new ReciptCancelBook();
                                reccan.AutoCancelRecNo = Convert.ToInt32("0");
                                reccan.EmpCode         = txtEMcode.Text.Trim();
                                reccan.FromNo          = Convert.ToInt32(lblReceiptNo.Text.Trim());
                                reccan.ToNo            = Convert.ToInt32(lblReceiptNo.Text.Trim());
                                if (txtReasonGrd.Text != "")
                                {
                                    reccan.Resion = txtReasonGrd.Text;
                                }
                                else
                                {
                                    reccan.Resion = txtResion.Text.Trim();
                                }

                                reccan.CreatedBy = Session["UserName"].ToString();
                                reccan.Save();
                                message("Record Saved Successfully");
                            }
                        }
                    }
                    message("Receipt No not found");
                    txtEMcode.Text = "";
                    txtFrom.Text   = "";
                    txtTo.Text     = "";
                    lblshow.Text   = "";
                    txtResion.Text = "";
                    gvMultipleCancel.DataSource = null;
                    gvMultipleCancel.DataBind();
                    multipal.Update();
                    //btn_Save.Visible = false;
                }
            }

            message("Receipt not found between entered Receipt no.");
        }
    }