protected void GvLookupPegawai_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Session["Triger"] != null)
            {
                if (Session["Triger"].ToString() == "txtFilterItem2")
                {
                    if (isEntryUseNIP())
                    {
                        this.txtFilterItem2.Text = ((Label)GvLookupPegawai.SelectedRow.Cells[0].FindControl("Label1")).Text;
                    }
                    else
                    {
                        this.txtFilterItem2.Text = GvLookupPegawai.SelectedRow.Cells[1].Text;
                    }
                }
                else if (Session["Triger"].ToString() == "txtItem0FormView")
                {
                    if (isEntryUseNIP())
                    {
                        ((TextBox)FvChangeShift.FindControl("txtItem0FormView")).Text = ((Label)GvLookupPegawai.SelectedRow.Cells[0].FindControl("Label1")).Text;
                        ((Label)FvChangeShift.FindControl("lblItem1FormView")).Text   = ((Label)GvLookupPegawai.SelectedRow.Cells[2].FindControl("Label2")).Text;
                    }
                    else
                    {
                        ((TextBox)FvChangeShift.FindControl("txtItem0FormView")).Text = GvLookupPegawai.SelectedRow.Cells[1].Text;
                        ((Label)FvChangeShift.FindControl("lblItem1FormView")).Text   = ((Label)GvLookupPegawai.SelectedRow.Cells[2].FindControl("Label2")).Text;
                    }
                }

                Session.Remove("Triger");
            }

            setInitialLookupState();
            UpdatePanel1.Update();
        }
        //fungsi: Set Nama ketika NIP berubah
        protected void txtItem0FormView_TextChanged(object sender, EventArgs e)
        {
            TextBox txtNIP  = (TextBox)FvChangeShift.FindControl("txtItem0FormView");
            Label   lblNama = (Label)FvChangeShift.FindControl("lblItem1FormView");

            setNama(txtNIP, lblNama);
        }
        //fungsi: Handle Ketika akan insert database
        protected void dsChangeShiftEdit_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            try
            {
                ViewState["TglAwal"]  = ((TextBox)FvChangeShift.FindControl("txtItem2FormView")).Text;
                ViewState["TglAkhir"] = ((TextBox)FvChangeShift.FindControl("txtItem3FormView")).Text;


                string  sNIP;
                TextBox NIP = (TextBox)FvChangeShift.FindControl("txtItem0FormView");
                if (isEntryUseNIP())
                {
                    sNIP = NIP.Text;
                }
                else
                {
                    sNIP = azlib.getNIP(NIP.Text, Application["strCn"].ToString());
                }
                TextBox TGL_AWAL  = (TextBox)FvChangeShift.FindControl("txtItem2FormView");
                TextBox TGL_AKHIR = (TextBox)FvChangeShift.FindControl("txtItem3FormView");
                e.Command.Parameters["@NIP"].Value       = sNIP;
                e.Command.Parameters["@TGL_AWAL"].Value  = DateTime.Parse(TGL_AWAL.Text);
                e.Command.Parameters["@TGL_AKHIR"].Value = DateTime.Parse(TGL_AKHIR.Text);
            }
            catch (Exception ex)
            {
                ExceptionDetails.Text = lblWrongDate.Text;
                e.Cancel = true;
            }
        }
 //fungsi: set kondisi awal komponen di FormView
 private void setInitialComponent()
 {
     ((TextBox)FvChangeShift.FindControl("txtItem0FormView")).Text = "";
     ((Label)FvChangeShift.FindControl("lblItem1FormView")).Text   = "";
     ((TextBox)FvChangeShift.FindControl("txtItem2FormView")).Text = DateTime.Now.ToShortDateString();
     ((TextBox)FvChangeShift.FindControl("txtItem3FormView")).Text = DateTime.Now.ToShortDateString();
     ((DropDownList)FvChangeShift.FindControl("ddlItem4FormView")).SelectedIndex = 0;
 }
 //fungsi: Handle Ketika akan mengupdate data pada database
 protected void dsChangeShiftEdit_Updating(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
     try
     {
         TextBox TGL_AKHIR = (TextBox)FvChangeShift.FindControl("txtItem3FormView");
         e.Command.Parameters["@TGL_AKHIR"].Value = DateTime.Parse(TGL_AKHIR.Text);
     }
     catch (Exception ex)
     {
         ExceptionDetails.Text = lblWrongDate.Text;
         e.Cancel = true;
     }
 }
        protected void FvChangeShift_DataBound(object sender, EventArgs e)
        {
            if (FvChangeShift.CurrentMode == FormViewMode.Insert)
            {
                if (isEntryUseNIP())
                {
                    ((Label)FvChangeShift.FindControl("lblPIN")).Visible = false;
                }
                else
                {
                    ((Label)FvChangeShift.FindControl("lblNip")).Visible = false;
                }

                if ((ViewState["TglAwal"] != null) && (ViewState["TglAkhir"] != null))
                {
                    ((TextBox)FvChangeShift.FindControl("txtItem2FormView")).Text = ViewState["TglAwal"].ToString();
                    ((TextBox)FvChangeShift.FindControl("txtItem3FormView")).Text = ViewState["TglAkhir"].ToString();
                    ViewState.Remove("TglAwal");
                    ViewState.Remove("TglAkhir");
                }
                else
                {
                    ((TextBox)FvChangeShift.FindControl("txtItem2FormView")).Text = DateTime.Now.ToShortDateString();
                    ((TextBox)FvChangeShift.FindControl("txtItem3FormView")).Text = DateTime.Now.ToShortDateString();
                }

                //TIGA
                RangeValidator ValTglAdd = (RangeValidator)FvChangeShift.FindControl("CompareValTglAdd");
                ValTglAdd.MinimumValue = DateTime.Parse(Session["tglTutup"].ToString()).ToShortDateString();

                TextBox txtNip = (TextBox)FvChangeShift.FindControl("txtItem0FormView");
                txtNip.Focus();
            }
            else if (FvChangeShift.CurrentMode == FormViewMode.Edit)
            {
                if (isEntryUseNIP())
                {
                    ((Label)FvChangeShift.FindControl("lblPIN")).Visible            = false;
                    ((Label)FvChangeShift.FindControl("lblItem0_FormView")).Visible = false;
                }
                else
                {
                    ((Label)FvChangeShift.FindControl("lblNip")).Visible           = false;
                    ((Label)FvChangeShift.FindControl("lblItem0FormView")).Visible = false;
                }
            }
        }