protected void ddlDesignation_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlDesignation.SelectedIndex < 1)
        {
            grdLeaveDetails.DataSource = null;
            grdLeaveDetails.DataBind();
            return;
        }
        try
        {
            EnableAddControls(true);
            List <ATTLeaveTypeDesignation> lstLeaveTypeDesignation = BLLLeaveTypeDesignation.GetLeaveTypeDesignation(null, int.Parse(ddlDesignation.SelectedValue));
            Session["LeaveTypeDesignation"] = lstLeaveTypeDesignation;
            //if (lstLeaveTypeDesignation.Count>0)
            //{
            //    ddlDesignation.Enabled = false;
            //}

            grdLeaveDetails.DataSource = lstLeaveTypeDesignation;
            grdLeaveDetails.DataBind();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message.ToString();
            this.programmaticModalPopup.Show();
        }
    }
    protected void grdEmployee_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.CollapsiblePanelExtender1.Collapsed = true;
        //System.Threading.Thread.Sleep(1000);

        this.CollapsiblePanelExtender1.ClientState = "true";
        this.CollapsiblePanelExtender1.Collapsed   = true;


        string Name = Server.HtmlDecode(grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[5].Text).ToString();
        int    id   = 0;
        List <ATTEmployeeLeave> lstEmployeeLeave = new List <ATTEmployeeLeave>();

        if (tabContainerEmpLeave.ActiveTabIndex == 0)
        {
            id = int.Parse(grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[0].Text);
            txtEmpName.Text = Name;
            txtEmpName.Attributes.Add("ID", grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[0].Text);
            lstEmployeeLeave = BLLEmployeeLeave.GetEmployeeLeave(id, "REQ");
            //grdEmployee.SelectedIndex = -1;
            Session["EmployeeLeave"]        = lstEmployeeLeave;
            grdLeaveApplications.DataSource = lstEmployeeLeave;
            grdLeaveApplications.DataBind();
        }
        else if (tabContainerEmpLeave.ActiveTabIndex == 1)
        {
            id = int.Parse(grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[0].Text);
            txtRecName.Text = Name;
            txtRecName.Attributes.Add("ID", grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[0].Text);
        }

        //Loading Leave Type Drop Down List

        if (tabContainerEmpLeave.ActiveTabIndex == 0)
        {
            int eid = int.Parse(txtEmpName.Attributes["ID"].ToString());
            List <ATTEmployeeLeave> LSTEmpDesLeave = BLLEmployeeLeave.GetEmpDesLeave(eid);
            //LSTEmpDesLeave.Insert(0, new ATTEmployeeLeave(0, 0, "-बिदाको किसिम छान्नुहोस्-"));
            ddlAppType.DataSource     = LSTEmpDesLeave;
            ddlAppType.DataTextField  = "LeaveType";
            ddlAppType.DataValueField = "LeaveTypeID";
            ddlAppType.DataBind();
            List <ATTLeaveTypeEmployee>    LSTLeaveTypeEmp = BLLLeaveTypeEmployee.GetLeaveTypeEmployee(null, eid);
            List <ATTLeaveTypeDesignation> LSTLeaveTypeDes = new List <ATTLeaveTypeDesignation>();
            int desID = 0;
            List <ATTEmployeePosting> LSTEmpPosting = BLLEmployeePosting.GetEmpPosting(double.Parse(eid.ToString()));
            if (LSTEmpPosting.Count > 0)
            {
                desID = LSTEmpPosting[0].DesID;
            }

            if (desID > 0)
            {
                LSTLeaveTypeDes = BLLLeaveTypeDesignation.GetLeaveTypeDesignation(null, desID);
                LSTLeaveTypeDes.Insert(0, new ATTLeaveTypeDesignation(0, "-बिदाको किसिम छान्नुहोस्-", 0, 0, "", 0, false, 0, false, "", "", ""));
            }
            //int? accrDays;
            if (LSTLeaveTypeEmp.Count < 1)
            {
                ddlAppType.DataSource     = LSTLeaveTypeDes;
                ddlAppType.DataTextField  = "LeaveType";
                ddlAppType.DataValueField = "LeaveTypeID";
                ddlAppType.DataBind();
            }
            else
            {
                List <ATTLeaveType> lstLeavetype = new List <ATTLeaveType>();
                foreach (ATTLeaveTypeEmployee var in LSTLeaveTypeEmp)
                {
                    ATTLeaveType attlv = new ATTLeaveType(var.LeaveTypeID, var.LeaveType, "");
                    lstLeavetype.Add(attlv);
                }
                if (desID > 0)
                {
                    foreach (ATTLeaveTypeEmployee var in LSTLeaveTypeEmp)
                    {
                        int i = LSTLeaveTypeDes.FindIndex(delegate(ATTLeaveTypeDesignation obj)
                        {
                            return(obj.LeaveTypeID != var.LeaveTypeID);
                        });
                        if (i > 0)
                        {
                            ATTLeaveType attlv = new ATTLeaveType(LSTLeaveTypeDes[i].LeaveTypeID, LSTLeaveTypeDes[i].LeaveType, "");
                            lstLeavetype.Add(attlv);
                        }
                    }
                }
                lstLeavetype.Insert(0, new ATTLeaveType(0, "-बिदाको किसिम छान्नुहोस्-", ""));
                ddlAppType.DataSource     = lstLeavetype;
                ddlAppType.DataTextField  = "LeaveTypeName";
                ddlAppType.DataValueField = "LeaveTypeID";
                ddlAppType.DataBind();
            }

            List <ATTEmployeeLeave> LSTEmpLeave = BLLEmployeeLeave.GetEmployeeLeave(eid, "REQ");
            Session["EmployeeLeave"] = LSTEmpLeave;


            if (BLLEmployeeLeave.GetEmployeeLeave(eid, "REQ").Count > 0)
            {
                PanelSearch.Enabled = true;
            }
            grdLeaveApplications.DataSource = LSTEmpLeave;
            grdLeaveApplications.DataBind();
        }
    }