protected void lstRegistrationType_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (lstOrganization.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "कार्यालय छान्नुस";
            this.programmaticModalPopup.Show();
            return;
        }

        if (lstCaseType.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "मुदाको प्रकार छाननुस";
            this.programmaticModalPopup.Show();
            return;
        }

        ClearControls();

        try
        {
            List <ATTOrgCaseRegTypeCheckList> OrgCaseRegChkLst = BLLOrgCaseRegTypeCheckList.GetOrgCaseRegTypeCheckList
                                                                 (
                int.Parse(lstOrganization.SelectedValue), int.Parse(lstCaseType.SelectedValue),
                int.Parse(lstRegistrationType.SelectedValue), null, null
                                                                 );
            foreach (ATTOrgCaseRegTypeCheckList att in OrgCaseRegChkLst)
            {
                foreach (GridViewRow row in grdCheckListType.Rows)
                {
                    CheckBox cbSelect = (CheckBox)(row.Cells[0].FindControl("chkSelect"));

                    if ((att.CheckListID == int.Parse(row.Cells[1].Text)) && (att.Active == "Y"))
                    {
                        cbSelect.Checked  = true;
                        row.Cells[3].Text = "Y";
                    }
                    else if ((att.CheckListID == int.Parse(row.Cells[1].Text)) && (att.Active == "N"))
                    {
                        cbSelect.Checked  = false;
                        row.Cells[3].Text = "N";
                    }
                }
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (lstOrganization.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "कार्यालय छान्नुस";
            this.programmaticModalPopup.Show();
            return;
        }

        if (lstCaseType.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "मुदाको प्रकार छाननुस";
            this.programmaticModalPopup.Show();
            return;
        }

        if (lstRegistrationType.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "दर्ताको प्रकार छाननुस";
            this.programmaticModalPopup.Show();
            return;
        }

        List <ATTOrgCaseRegTypeCheckList> OrgCaseRegTypeChkLst    = new List <ATTOrgCaseRegTypeCheckList>();
        ATTOrgCaseRegTypeCheckList        ObjOrgCaesregTypeChkLst = new ATTOrgCaseRegTypeCheckList();

        foreach (GridViewRow row in grdCheckListType.Rows)
        {
            CheckBox cbSelect = (CheckBox)(row.Cells[0].FindControl("chkSelect"));

            if (cbSelect.Checked == true && row.Cells[3].Text == "N")
            {
                ObjOrgCaesregTypeChkLst = new ATTOrgCaseRegTypeCheckList
                                              (int.Parse(lstOrganization.SelectedValue),
                                              int.Parse(lstCaseType.SelectedValue),
                                              int.Parse(lstRegistrationType.SelectedValue),
                                              int.Parse(row.Cells[1].Text),
                                              "", strUser, "Y", "E"
                                              );
            }
            else if (cbSelect.Checked == false && row.Cells[3].Text == "Y")
            {
                ObjOrgCaesregTypeChkLst = new ATTOrgCaseRegTypeCheckList
                                              (int.Parse(lstOrganization.SelectedValue),
                                              int.Parse(lstCaseType.SelectedValue),
                                              int.Parse(lstRegistrationType.SelectedValue),
                                              int.Parse(row.Cells[1].Text),
                                              "", strUser, "N", "E"
                                              );
            }
            else if (cbSelect.Checked == true && row.Cells[3].Text == "")
            {
                ObjOrgCaesregTypeChkLst = new ATTOrgCaseRegTypeCheckList
                                              (int.Parse(lstOrganization.SelectedValue),
                                              int.Parse(lstCaseType.SelectedValue),
                                              int.Parse(lstRegistrationType.SelectedValue),
                                              int.Parse(row.Cells[1].Text),
                                              "", strUser, "Y", "A"
                                              );
            }
            else
            {
                continue;
            }
            OrgCaseRegTypeChkLst.Add(ObjOrgCaesregTypeChkLst);
        }



        if (OrgCaseRegTypeChkLst.Count == 0)
        {
            return;
        }
        try
        {
            if (BLLOrgCaseRegTypeCheckList.SaveOrgCaseRegTypeCheckList(OrgCaseRegTypeChkLst))
            {
                ClearControls();
                lstRegistrationType.SelectedIndex = -1;
                this.lblStatusMessage.Text        = "Successfully Saved";
                this.programmaticModalPopup.Show();
                return;
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }