protected void Button1_Click(object sender, EventArgs e)
    {
        if (lstInstructors.SelectedValue != "")
        {
            //txtLoad.Text = lstInstructors.SelectedValue;
            //calApp.SelectedDate = GetStartDate();
            //calApp.Visible = true;

            Session["DocID"] = lstInstructors.SelectedValue.ToString();
            PatientDoctorTableAdapter adap_patDoc = new PatientDoctorTableAdapter();
            DataSet1.PatientDoctorDataTable dt = new DataSet1.PatientDoctorDataTable();
            dt = adap_patDoc.GetData(Convert.ToInt32(Session["PatientID"]));

            if (dt.Rows.Count == 0 || !dt.Rows[0][0].ToString().Equals(Session["DocID"]))
            {
                QueriesTableAdapter adap_ins = new QueriesTableAdapter();
                adap_ins.PatDocInsertQuery(Convert.ToInt32(Session["PatientID"]), Convert.ToInt32(Session["DocID"]));

                lblMessage.ForeColor = Color.White;
                lblMessage.BackColor = Color.White;
                lblMessage.Text = "Doctor Added Successfully!";
                dt = adap_patDoc.GetData(Convert.ToInt32(Session["PatientID"]));
                GridView1.Visible = true;
                GridView1.DataBind();
                lblMessage.Visible = false;
                lstInstructors.Visible = false;
                LBLdOC.Visible = false;
                txtSearchValue.Text = string.Empty;
                Button1.Visible = false;
            }
            else
            {
                lblMessage.ForeColor = Color.Black;
                lblMessage.BackColor = Color.Red;
                lblMessage.Text = "You have already added this doctor.";
            }
        }

        else
        {
            lblMessage.ForeColor = Color.Black;
            lblMessage.BackColor = Color.Red;
            lblMessage.Text = "Please select a Doctor.";
        }
    }