protected void Button1_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt = (DataTable)ViewState["Programs"];

            AttendanceTbl att = db.AttendanceTbls.SingleOrDefault(asd => asd.fname.ToLower() == txtfname.Text.ToLower() && asd.lname.ToLower() == txtlname.Text.ToLower() && asd.FkTechID == Convert.ToInt16(drpTechnology.SelectedItem.Value) && asd.FkPID == Convert.ToInt16(drpProgram.SelectedItem.Value) && asd.FKBID == Convert.ToInt16(drpBranch.SelectedItem.Value) && Convert.ToDateTime(asd.AtDate).Date == System.DateTime.Now.Date);

            if (att != null)
            {
                if (att.fname != "")
                {
                    lblDuration.Text = "<div class='alert alert-danger'><strong>Error!</strong></div>Dear,<br>" + txtfname.Text + " " + txtlname.Text + "<br/>You are already LoggedIn.<b><br/>Please logout if your practical session completed.<br/>or else Contact any one faculty.!!";
                    ModalPopupDuration.BackgroundCssClass = "popupBackRed";
                    ModalPopupDuration.Show();
                }
            }
            else
            {
                cmd             = new SqlCommand("AddNewAttendance", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@BID", drpBranch.SelectedItem.Value);
                cmd.Parameters.AddWithValue("@Fname", txtfname.Text);
                cmd.Parameters.AddWithValue("@Lname", txtlname.Text);
                cmd.Parameters.AddWithValue("@TID", drpTechnology.SelectedItem.Value);
                cmd.Parameters.AddWithValue("@PID", drpProgram.SelectedItem.Value);
                cmd.Parameters.AddWithValue("@IT", txtInTime.Text);
                cmd.Parameters.AddWithValue("@OT", "");
                con.Open();
                bool status = Convert.ToBoolean(cmd.ExecuteNonQuery());
                con.Close();
                if (status)
                {
                    lblDuration.Text = "<div class='alert alert-success'><strong>Success!</strong></div>Dear,<br>" + txtfname.Text + " " + txtlname.Text + "<br/>Your InTime is <b>" + txtInTime.Text + "</b><br/>Your practical session for <b>" + dt.Rows[drpProgram.SelectedIndex - 1]["Duration"].ToString() + "</b> only!!";
                    ModalPopupDuration.BackgroundCssClass = "popupBack";
                    ModalPopupDuration.Show();
                    txtfname.Text               = "";
                    txtlname.Text               = "";
                    drpBranch.SelectedIndex     = 0;
                    drpProgram.SelectedIndex    = 0;
                    drpTechnology.SelectedIndex = 0;
                    status = false;
                }
            }
        }
 partial void UpdateAttendanceTbl(AttendanceTbl instance);
 partial void DeleteAttendanceTbl(AttendanceTbl instance);
 partial void InsertAttendanceTbl(AttendanceTbl instance);