private void ClearAll()
 {
     lblEmpName.Text           = "";
     lblEmpDept.Text           = "";
     lblDesi.Text              = "";
     lblempDiv.Text            = "";
     ddlDept.SelectedIndex     = -1;
     ddlDesig.SelectedIndex    = -1;
     ddlDividion.SelectedIndex = -1;
     (Calender1.FindControl("TextBox1") as TextBox).Text = "";
     txtEmpCode.Text = "";
     txtEmpCode.Focus();
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string TransferAcciDate = (Calender1.FindControl("TextBox1") as TextBox).Text;

            con.Open();
            SqlCommand cmd  = new SqlCommand("insert into tbleTransferInfo(EmpCode,EmpName,OldDeptCode,OldDesignationCode,OldDivCode,NewDeptCode,NewDesigtnationCode,NewDivCode,TrActivateDate) values('" + txtEmpCode.Text + "','" + lblEmpName.Text + "','" + lblEmpDept.Text + "','" + lblDesi.Text + "','" + lblempDiv.Text + "','" + ddlDept.SelectedValue + "','" + ddlDesig.SelectedValue + "','" + ddlDividion.SelectedValue + "','" + TransferAcciDate + "')", con);
            SqlCommand cmd1 = new SqlCommand("update tblEmployee set DeptCode='" + ddlDept.SelectedValue + "',DesigCode='" + ddlDesig.SelectedValue + "',DivCode='" + ddlDividion.SelectedValue + "'  where EmpCode='" + txtEmpCode.Text + "'", con);

            cmd.ExecuteNonQuery();
            cmd1.ExecuteNonQuery();
            Literal1.Text = "Data saved successfully!!!";
            LoadGrid();
            ClearAll();
            con.Close();
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            SqlDataAdapter sda = new SqlDataAdapter("select EmpName,OldDeptCode,OldDesignationCode,OldDivCode,NewDeptCode,NewDesigtnationCode,NewDivCode,TrActivateDate from tbleTransferInfo where EmpCode='" + txtEmpCode.Text + "'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            lblEmpName.Text           = dt.Rows[0]["EmpName"].ToString();
            lblEmpDept.Text           = dt.Rows[0]["OldDeptCode"].ToString();
            lblDesi.Text              = dt.Rows[0]["OldDesignationCode"].ToString();
            lblempDiv.Text            = dt.Rows[0]["OldDivCode"].ToString();
            ddlDept.SelectedValue     = dt.Rows[0]["NewDeptCode"].ToString();
            ddlDesig.SelectedValue    = dt.Rows[0]["NewDesigtnationCode"].ToString();
            ddlDividion.SelectedValue = dt.Rows[0]["NewDivCode"].ToString();
            (Calender1.FindControl("TextBox1") as TextBox).Text = dt.Rows[0]["TrActivateDate"].ToString();
        }