protected void GridView_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        pnlDonor.Visible        = true;
        pnlshow.Visible         = true;
        pnlBene.Visible         = false;
        dtinfo.DateSeparator    = "/";
        dtinfo.ShortDatePattern = "dd/MM/yyyy";
        iminfo = new IMInfo();
        string[] strInfo = iminfo.info(GridIM.SelectedRow.Cells[1].Text.ToString());
        lblDIMID.Text     = GridIM.SelectedRow.Cells[1].Text.ToString();
        lblDName.Text     = strInfo[0].ToString();
        lblDAddress1.Text = strInfo[1].ToString();
        lblDAddress2.Text = strInfo[2].ToString();
        lblDCity.Text     = strInfo[3].ToString() + ", " + strInfo[4].ToString() + "-" + strInfo[5].ToString();

        String[] strimac = iminfo.imac(GridIM.SelectedRow.Cells[1].Text.ToString());
        lblDLateFees.Text = strimac[0].ToString().TrimEnd('0').TrimEnd('.');
        lblDAmount.Text   = strimac[1].ToString().TrimEnd('0').TrimEnd('.');
        lblDGAmount.Text  = strimac[2].ToString().TrimEnd('0').TrimEnd('.');

        lblSubDate.Text = GridIM.SelectedRow.Cells[3].Text.ToString();
        lblDDNo.Text    = GridIM.SelectedRow.Cells[4].Text.ToString();
        lblBankNo.Text  = GridIM.SelectedRow.Cells[5].Text.ToString();
        lblAmount.Text  = GridIM.SelectedRow.Cells[2].Text.ToString().TrimEnd('0').TrimEnd('.');
        lblDiaryNo.Text = GridIM.SelectedRow.Cells[7].Text.ToString();
        lblSession.Text = GridIM.SelectedRow.Cells[6].Text.ToString();
    }
    private void showdiary()
    {
        pnlDepartment.Visible = false;
        pnlVisiblefls();
        con.Close(); con.Open();
        cmd = new SqlCommand("select * from DiaryEntry where DiaryNo='" + txtDiaryNo.Text.ToString() + "' and ExamSession='" + lblHiddenSeason.Text.ToString() + "'", con);
        SqlDataReader reader;

        reader = cmd.ExecuteReader();
        while (reader.Read())
        {
            diarytype         = reader["MemberType"].ToString();
            lblRemark.Text    = reader["Remark"].ToString();
            lblIMID.Text      = reader["MembershipNo"].ToString();
            lblIMName.Text    = reader["Name"].ToString();
            lblSubDate.Text   = Convert.ToDateTime(reader["Date"].ToString()).ToString("dd/MM/yyyy");
            lblIMAddress.Text = reader["Address1"].ToString() + "\n" + reader["Address2"].ToString();
            lblIMCity.Text    = reader["City"].ToString() + "\n Phone No:" + reader["Phone"].ToString();
            txtPEmpName.Text  = diarytype;
        }
        reader.Close();
        if (diarytype == "IM")
        {
            IMInfo infos = new IMInfo();
            iminfos = infos.info(lblIMID.Text.ToString());
            if (iminfos[0].ToString() != null | iminfos[0].ToString() != "null")
            {
                lblIMName.Text    = iminfos[0].ToString();
                lblIMAddress.Text = iminfos[1].ToString() + "\n" + iminfos[2].ToString();
                lblIMCity.Text    = iminfos[3].ToString() + ", " + iminfos[4].ToString() + "-" + iminfos[5].ToString();
            }
        }
        else if (diarytype == "Other")
        {
            lblIMName.Text.ToString();
            lblIMID.Text               = "";
            pnlToFrom.Visible          = true;
            tblEmpNameAcademic.Visible = true; pnlDepartment.Visible = true;
        }
        else if (diarytype == "Student")
        {
            cmd    = new SqlCommand("select Name,PAddress,PAddress2,PCity,PState,Phone,Mobile from Student where SID='" + lblIMID.Text.ToString() + "'", con);
            reader = cmd.ExecuteReader();
            if (reader.Read())
            {
                lblIMName.Text    = reader["Name"].ToString();
                lblIMAddress.Text = reader["PAddress"].ToString() + "\n" + reader["PAddress2"].ToString();
                lblIMCity.Text    = reader["PCity"].ToString() + ", " + reader["PState"].ToString() + " Contact: " + reader["Mobile"].ToString();
            }
            reader.Close();
        }
        con.Close();
    }
    protected void txtBIM_ONTextChanged(object sender, EventArgs e)
    {
        pnlBene.Visible = true;
        iminfo          = new IMInfo();
        if (iminfo.isIMHave(txtBIM.Text.ToString()))
        {
            string[] strinfo = iminfo.info(txtBIM.Text.ToString());
            lblBName.Text     = strinfo[0].ToString();
            lblBAddress.Text  = strinfo[1].ToString();
            lblBAddress2.Text = strinfo[2].ToString();
            lblBcity.Text     = strinfo[3].ToString() + ", " + strinfo[4].ToString() + "-" + strinfo[5].ToString();

            string[] strimac = iminfo.imac(txtBIM.Text.ToString());
            lblBLate.Text    = strimac[0].ToString();
            lblBTotal.Text   = strimac[1].ToString();
            lblBGAmount.Text = strimac[2].ToString();
        }
        else
        {
            txtBIM.Text = "Invalid IMID.";
        }
    }