private void LoadSTNotification(GridView eGrid)
        {
            STN_GetAllTableAdapter index = new STN_GetAllTableAdapter();
            DataTable dtActsIndexName = index.STN_GetAll();
            if (dtActsIndexName.Rows.Count > 0)
            {
                editGrid.Visible = true;
                editGrid.DataSource = dtActsIndexName;
                editGrid.DataBind();
                if (editGrid.Columns.Count > 0)
                    editGrid.Columns[0].Visible = false;
                else
                {
                    editGrid.HeaderRow.Cells[1].Visible = false;
                    editGrid.HeaderRow.Cells[2].Visible = false;
                    editGrid.HeaderRow.Cells[7].Visible = false;
                    editGrid.HeaderRow.Cells[8].Visible = false;
                    foreach (GridViewRow gvr in editGrid.Rows)
                    {
                        gvr.Cells[1].Visible = false;
                        gvr.Cells[2].Visible = false;
                        gvr.Cells[7].Visible = false;
                        gvr.Cells[8].Visible = false;
                    }
                }

                // editGrid.Columns[1].Visible = false;
            }
        }
        protected void editGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridView gv = sender as GridView;
            GridViewRow row = gv.Rows[e.RowIndex];
               // int? id = Int32.Parse(row.Cells[2].Text);
            if (ddlsubcategory.SelectedValue.Equals("Acts") && ddlcatagory.SelectedValue.Equals("Central Excise"))
            {
                int? id = Int32.Parse(row.Cells[2].Text);
                CEActsTableAdapter index = new CEActsTableAdapter();
                index.CEDeleteById(id);
                LoadCEActs(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Rules") && ddlcatagory.SelectedValue.Equals("Central Excise"))
            {
                int? id = Int32.Parse(row.Cells[2].Text);
                CEActsTableAdapter index = new CEActsTableAdapter();
                index.CEDeleteById(id);
                LoadCEActs(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Forms") && ddlcatagory.SelectedValue.Equals("Central Excise"))
            {
                int? id = Int32.Parse(row.Cells[2].Text);
                CEActsTableAdapter index = new CEActsTableAdapter();
                index.CEDeleteById(id);
                LoadCEActs(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Section 37B Order") && ddlcatagory.SelectedValue.Equals("Central Excise"))
            {
                int? id = Int32.Parse(row.Cells[2].Text);
                CEActsTableAdapter index = new CEActsTableAdapter();
                index.CEDeleteById(id);
                LoadCEActs(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Case Laws") && ddlcatagory.SelectedValue.Equals("Central Excise"))
            {
                int? id = Int32.Parse(row.Cells[2].Text);
                CEActsTableAdapter index = new CEActsTableAdapter();
                index.CEDeleteById(id);
                LoadCEActs(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Tariff 2012-13") && ddlcatagory.SelectedValue.Equals("Central Excise"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                CentralExcise_Tariff_GetAllTableAdapter index = new CentralExcise_Tariff_GetAllTableAdapter();
                index.DeleteTariffById(id);
                LoadCETariff(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Notifications") && ddlcatagory.SelectedValue.Equals("Central Excise"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                CECNotification_GetAllTableAdapter index = new CECNotification_GetAllTableAdapter();
                index.DeleteCENotificationById(id);
                LoadCENotification(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions") && ddlcatagory.SelectedValue.Equals("Central Excise"))
            {
                int? id = Int32.Parse(row.Cells[5].Text);
                Circulars_Info_ByyearTableAdapter index = new Circulars_Info_ByyearTableAdapter();
                index.DeleteCEcircularsById(id);
                LoadCECircularsInstructions(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Acts") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[3].Text);
                ActsTableAdapter index = new ActsTableAdapter();
                index.DeleteCustomsById(id);
                LoadCustoms(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Rules") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[3].Text);
                ActsTableAdapter index = new ActsTableAdapter();
                index.DeleteCustomsById(id);
                LoadCustoms(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Forms") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[3].Text);
                ActsTableAdapter index = new ActsTableAdapter();
                index.DeleteCustomsById(id);
                LoadCustoms(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Case Laws") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[3].Text);
                ActsTableAdapter index = new ActsTableAdapter();
                index.DeleteCustomsById(id);
                LoadCustoms(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Regulations") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[3].Text);
                ActsTableAdapter index = new ActsTableAdapter();
                index.DeleteCustomsById(id);
                LoadCustoms(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Tariff 2012-13") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                Custom_Tariff_GetAllTableAdapter index = new Custom_Tariff_GetAllTableAdapter();
                index.DeleteCustomTariffById(id);
                LoadCustomsTariff(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Notifications") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                CECNotification_GetAllTableAdapter index = new CECNotification_GetAllTableAdapter();
                index.DeleteCENotificationById(id);
                LoadCENotification(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[5].Text);
                Circulars_Info_ByyearTableAdapter index = new Circulars_Info_ByyearTableAdapter();
                index.DeleteCEcircularsById(id);
                LoadCECircularsInstructions(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("SEZ") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[3].Text);
                ActsTableAdapter index = new ActsTableAdapter();
                index.DeleteCustomsById(id);
                LoadCustoms(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Drawback Schedule") && ddlcatagory.SelectedValue.Equals("Customs"))
            {
                int? id = Int32.Parse(row.Cells[3].Text);
                ActsTableAdapter index = new ActsTableAdapter();
                index.DeleteCustomsById(id);
                LoadCustoms(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Act 1994") && ddlcatagory.SelectedValue.Equals("Service Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                ServiceTax_GetAllTableAdapter index = new ServiceTax_GetAllTableAdapter();
                index.DeleteSTById(id);
                LoadST(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("ST Rules") && ddlcatagory.SelectedValue.Equals("Service Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                ServiceTax_GetAllTableAdapter index = new ServiceTax_GetAllTableAdapter();
                index.DeleteSTById(id);
                LoadST(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Forms and Registers") && ddlcatagory.SelectedValue.Equals("Service Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                ServiceTax_GetAllTableAdapter index = new ServiceTax_GetAllTableAdapter();
                index.DeleteSTById(id);
                LoadST(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Accounting Codes for new services") && ddlcatagory.SelectedValue.Equals("Service Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                ServiceTax_GetAllTableAdapter index = new ServiceTax_GetAllTableAdapter();
                index.DeleteSTById(id);
                LoadST(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Case Laws") && ddlcatagory.SelectedValue.Equals("Service Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                STCaselaws_GetAllTableAdapter index = new STCaselaws_GetAllTableAdapter();
                index.DeleteSTCaseLawsById(id);
                LoadSTCaseLaws(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Notifications") && ddlcatagory.SelectedValue.Equals("Service Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                STN_GetAllTableAdapter index = new STN_GetAllTableAdapter();
                index.DeleteSTNById(id);
                LoadSTNotification(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions") && ddlcatagory.SelectedValue.Equals("Service Tax"))
            {
                int? id = Int32.Parse(row.Cells[5].Text);
                Circulars_Info_ByyearTableAdapter index = new Circulars_Info_ByyearTableAdapter();
                index.DeleteCEcircularsById(id);
                LoadCECircularsInstructions(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Acts") && ddlcatagory.SelectedValue.Equals("Income Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                IncomeTaxActs_SelectAllTableAdapter index = new IncomeTaxActs_SelectAllTableAdapter();
                index.DeleteITActsById(id);
                LoadITActs(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Rules") && ddlcatagory.SelectedValue.Equals("Income Tax"))
            {
                int? id = Int32.Parse(row.Cells[9].Text);
                IncomeTaxRules_SelectAllTableAdapter index = new IncomeTaxRules_SelectAllTableAdapter();
                index.DeleteITRulesById(id);
                LoadITRules(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Circulars") && ddlcatagory.SelectedValue.Equals("Income Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                IncomeTaxCircularsNotification_SelectAllTableAdapter index = new IncomeTaxCircularsNotification_SelectAllTableAdapter();
                index.DeleteITCNById(id);
                LoadITCN(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Notifications") && ddlcatagory.SelectedValue.Equals("Income Tax"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                IncomeTaxCircularsNotification_SelectAllTableAdapter index = new IncomeTaxCircularsNotification_SelectAllTableAdapter();
                index.DeleteITCNById(id);
                LoadITCN(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("FTP") && ddlcatagory.SelectedValue.Equals("DGFT"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                DGFT_GetAllTableAdapter index = new DGFT_GetAllTableAdapter();
                index.DeleteDGFTById(id);
                LoadDGFT(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("FTDR Notifications") && ddlcatagory.SelectedValue.Equals("DGFT"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                DGFT_GetAllTableAdapter index = new DGFT_GetAllTableAdapter();
                index.DeleteDGFTById(id);
                LoadDGFT(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("public notices") && ddlcatagory.SelectedValue.Equals("DGFT"))
            {
                int? id = Int32.Parse(row.Cells[1].Text);
                DGFTpublicnotices_GETALLTableAdapter index = new DGFTpublicnotices_GETALLTableAdapter();
                index.DeleteDgftPNById(id);
                LoadDGFTPN(editGrid);
            }
            if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions") && ddlcatagory.SelectedValue.Equals("DGFT"))
            {

            }
            if (ddlsubcategory.SelectedValue.Equals("SION") && ddlcatagory.SelectedValue.Equals("DGFT"))
            {

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                pnlCActs.Visible = false;
                pnlCRules.Visible = false;
                pnlCRegulations.Visible = false;
                pnlCTariff.Visible = false;
                pnlCForms.Visible = false;
                pnlCSEZ.Visible = false;
                pnlCDrawback.Visible = false;
                pnlCirculars.Visible = false;
                pnlSTCaselaws.Visible = false;
                edtData.Visible = false;
                uploadDocument.Visible = false;
                lblPasteHere.Visible = false;
                lblUploadDoc.Visible = false;
                btnUpload.Visible = false;
                rdbUploadType.Visible = false; pnllibrary.Visible = false;
                pnlDGFTFTDR.Visible = false;
                pnlDGFTFTP.Visible = false;
                pnlDGFTpublicnotices.Visible = false;
                pnlCECnotifications.Visible = false;
                pnlStNotifications.Visible = false;

                pnlITType.Visible = false;
                pnlITIncomeWealthAct.Visible = false;
                pnpITFinanceAct.Visible = false;
                pnlITCirculars.Visible = false;
               // cldate.EndDate = DateTime.Now;
            }
            editnotifications epage = Context.Handler as editnotifications;
            if (epage != null)
            {
                ddlcatagory.SelectedValue = epage.Category;
                ddlcatagory_SelectedIndexChanged(ddlcatagory, EventArgs.Empty);
                ddlsubcategory.SelectedValue = epage.SubCategory;
                ddlsubcategory_SelectedIndexChanged(ddlsubcategory, EventArgs.Empty);
                ddlcatagory.Enabled = false;
                ddlsubcategory.Enabled = false;
                hdnId.Value = epage.Id;
            }

            if (hdnId.Value.Length > 0)
            {
                int? id = Int32.Parse(hdnId.Value);
                if (btnUpload.Text != "Update")
                {
                    btnUpload.Text = "Update";
                    if (ddlsubcategory.SelectedValue.Equals("Case Laws"))
                    {
                        GetAllCaseLawsTableAdapter index = new GetAllCaseLawsTableAdapter();
                        TaxGenie_DAL.CaseLaws.GetAllCaseLawsDataTable dt = index.GetCaseLawsById(id);
                        TaxGenie_DAL.CaseLaws.GetAllCaseLawsRow row = dt.Rows[0] as TaxGenie_DAL.CaseLaws.GetAllCaseLawsRow;
                        txtCLcitationyear.Text = row.Year.ToString();
                        txtCLcitationyear.Enabled = false;
                        txtClNumber.Text = row.CLnumber;
                        txtClNumber.Enabled = false;
                        int ind = row.Year.ToString().Length + row.CLnumber.Length + 7;
                        txtCL.Text = row.TGOLCitation.Substring(ind);
                        txtCL.Enabled = false;
                        txtCLcasenumber.Text = row.CaseNumber;

                        txtCLAPPELLANTParty.Text = row.APPELLANTParty;
                        txtCLrespondentparty.Text = row.RESPONDENTParty;
                        txtCLjudgesname.Text = row.JudgesName;
                        txtCLdateofdec.Text = row.DateofDecision.ToString("MM-dd-yyyy");
                        txtCLJinFavour.SelectedValue = row.JudgementinFavourof;
                        edtCLheadnotes.Content = row.HeadNotes;
                        edtCLcontent.Content = row.JUDGEMENTContent;
                        if (ddlCLlawscourt.Items.Contains(new ListItem(row.Court)))
                        {
                            ddlCLlawscourt.SelectedValue = row.Court;
                        }
                        else
                        {
                            ddlCLlawscourt.SelectedValue = "Other";
                            ddlOtherCourt.SelectedValue = row.Court;
                        }
                        ddlCLlawscourt_SelectedIndexChanged(ddlCLlawscourt, EventArgs.Empty);
                        lbshowDoc.Visible = false;
                    }
                    if (ddlcatagory.SelectedValue.Equals("Central Excise"))
                    {
                        CEActsTableAdapter index = new CEActsTableAdapter();
                        DataTable dtActs = index.CEGetAllById(id);
                        if (dtActs.Rows.Count > 0)
                        {
                            if (ddlsubcategory.SelectedValue.Equals("Acts"))
                            {
                                txtCActsIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtCActsChapterName.Text = dtActs.Rows[0]["ChapterName"].ToString();
                                edtCActsSections.Content = dtActs.Rows[0]["Sections"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("Rules"))
                            {
                                txtCRulesIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtSubRulesChapterName.Text = dtActs.Rows[0]["ChapterName"].ToString();
                                ddlCRulesIndexGroup.SelectedValue = dtActs.Rows[0]["Headings"].ToString();
                                edtSubRulesSections.Content = dtActs.Rows[0]["Sections"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("Forms"))
                            {
                                txtCFormsIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtFormsSubject.Text = dtActs.Rows[0]["Subjects"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("Section 37B Order"))
                            {
                                txtCDrawbackIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            //if (ddlsubcategory.SelectedValue.Equals("Case Laws"))
                            //{
                            //    txtCDrawbackIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                            //    bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                            //    rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                            //    rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                            //    edtData.Content = dtActs.Rows[0]["Data"].ToString();
                            //    lbshowDoc.Visible = !isdoc;
                            //}

                        }

                        if (ddlsubcategory.SelectedValue.Equals("Tariff 2012-13"))
                        {
                            CentralExcise_Tariff_GetAllTableAdapter indexTariff = new CentralExcise_Tariff_GetAllTableAdapter();
                            DataTable dtTariff = indexTariff.SelectAllById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                ddlCtariffheading.SelectedValue = dtTariff.Rows[0]["Groups"].ToString();
                                ddlCtariffheading_SelectedIndexChanged(ddlCtariffheading, EventArgs.Empty);
                                ddlCtariffsubheading.SelectedValue = dtTariff.Rows[0]["SubGroup"].ToString();
                                txtCtariffchapter.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                txtCtariffChaptername.Text = dtTariff.Rows[0]["ChapterName"].ToString();
                                txtCtariffsubj.Text = dtTariff.Rows[0]["Subjects"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                        if (ddlsubcategory.SelectedValue.Equals("Notifications"))
                        {
                            CECNotification_GetAllTableAdapter indexTariff = new CECNotification_GetAllTableAdapter();
                            DataTable dtTariff = indexTariff.SelectAllCENotificationById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                rdbCECType.SelectedValue = dtTariff.Rows[0]["GroupType"].ToString();
                                ddlCtariffheading_SelectedIndexChanged(ddlCtariffheading, EventArgs.Empty);
                                txtCECYear.Text = dtTariff.Rows[0]["Year"].ToString();
                                txtCECFnumber.Text = dtTariff.Rows[0]["FileNumber"].ToString();
                                txtCECDate.Text = dtTariff.Rows[0]["Date"].ToString();
                                txtCECSubject.Text = dtTariff.Rows[0]["Subject"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                        if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions"))
                        {
                            Circulars_Info_ByyearTableAdapter indexTariff = new Circulars_Info_ByyearTableAdapter();
                            DataTable dtTariff = indexTariff.GetCEcircularsById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                bool isCircular = dtTariff.Rows[0]["GroupType"] == "Circulars";
                                rdbCircularUploadType.SelectedValue = isCircular ? "Circulars" : "Instructions";
                                txtCircularYear.Text = dtTariff.Rows[0]["Year"].ToString();
                                txtCircularNumber.Text = dtTariff.Rows[0]["CircularNumber"].ToString();
                                txtCircularFileNumber.Text = dtTariff.Rows[0]["FileNumber"].ToString();
                                txtCircularDate.Text = dtTariff.Rows[0]["Date"].ToString();
                                txtCircularSubject.Text = dtTariff.Rows[0]["Subject"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                    }
                    if (ddlcatagory.SelectedValue.Equals("Customs"))
                    {
                        ActsTableAdapter index = new ActsTableAdapter();
                        DataTable dtActs = index.GetAllCustomsById(id);
                        if (dtActs.Rows.Count > 0)
                        {
                            if (ddlsubcategory.SelectedValue.Equals("Acts"))
                            {
                                txtCActsIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtCActsChapterName.Text = dtActs.Rows[0]["ChapterName"].ToString();
                                edtCActsSections.Content = dtActs.Rows[0]["Sections"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("Rules"))
                            {
                                txtCRulesIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtSubRulesChapterName.Text = dtActs.Rows[0]["ChapterName"].ToString();
                                ddlCRulesIndexGroup.SelectedValue = dtActs.Rows[0]["Headings"].ToString();
                                edtSubRulesSections.Content = dtActs.Rows[0]["Sections"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("Forms"))
                            {
                                ddlCformsgroup.SelectedValue = dtActs.Rows[0]["Headings"].ToString();
                                ddlCformsgroup_SelectedIndexChanged(ddlCformsgroup, EventArgs.Empty);
                                ddlCformssubgroups.SelectedValue = dtActs.Rows[0]["SubHeadings"].ToString();
                                txtCFormsIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtFormsSubject.Text = dtActs.Rows[0]["Subjects"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("Regulations"))
                            {
                                txtCRegulationsIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            //if (ddlsubcategory.SelectedValue.Equals("Case Laws"))
                            //{
                            //    txtCDrawbackIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                            //    bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                            //    rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                            //    rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                            //    edtData.Content = dtActs.Rows[0]["Data"].ToString();
                            //    lbshowDoc.Visible = !isdoc;
                            //}
                            if (ddlsubcategory.SelectedValue.Equals("Drawback Schedule"))
                            {
                                txtCDrawbackIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("SEZ"))
                            {
                                txtCSEZNotficationNo.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtCSEZSubject.Text = dtActs.Rows[0]["Subjects"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }

                        }
                        if (ddlsubcategory.SelectedValue.Equals("Tariff 2012-13"))
                        {
                            Custom_Tariff_GetAllTableAdapter indexTariff = new Custom_Tariff_GetAllTableAdapter();
                            DataTable dtTariff = indexTariff.SelectCustomTariffById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                ddlCtariffheading.SelectedValue = dtTariff.Rows[0]["Groups"].ToString();
                                ddlCtariffheading_SelectedIndexChanged(ddlCtariffheading, EventArgs.Empty);
                                ddlCtariffsubheading.SelectedValue = dtTariff.Rows[0]["SubGroup"].ToString();
                                txtCtariffchapter.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                txtCtariffChaptername.Text = dtTariff.Rows[0]["ChapterName"].ToString();
                                txtCtariffsubj.Text = dtTariff.Rows[0]["Subjects"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                        if (ddlsubcategory.SelectedValue.Equals("Notifications"))
                        {
                            CECNotification_GetAllTableAdapter indexTariff = new CECNotification_GetAllTableAdapter();
                            DataTable dtTariff = indexTariff.SelectAllCENotificationById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                rdbCECType.SelectedValue = dtTariff.Rows[0]["GroupType"].ToString();
                                ddlCtariffheading_SelectedIndexChanged(ddlCtariffheading, EventArgs.Empty);
                                txtCECYear.Text = dtTariff.Rows[0]["Year"].ToString();
                                txtCECFnumber.Text = dtTariff.Rows[0]["FileNumber"].ToString();
                                txtCECDate.Text = dtTariff.Rows[0]["Date"].ToString();
                                txtCECSubject.Text = dtTariff.Rows[0]["Subject"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                        if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions"))
                        {
                            Circulars_Info_ByyearTableAdapter indexTariff = new Circulars_Info_ByyearTableAdapter();
                            DataTable dtTariff = indexTariff.GetCEcircularsById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                bool isCircular = dtTariff.Rows[0]["GroupType"].ToString().Equals("Circulars");
                                rdbCircularUploadType.SelectedValue = isCircular ? "Circulars" : "Instructions";
                                txtCircularYear.Text = dtTariff.Rows[0]["Year"].ToString();
                                txtCircularNumber.Text = dtTariff.Rows[0]["CircularNumber"].ToString();
                                txtCircularFileNumber.Text = dtTariff.Rows[0]["FileNumber"].ToString();
                                txtCircularDate.Text = dtTariff.Rows[0]["Date"].ToString();
                                txtCircularSubject.Text = dtTariff.Rows[0]["Subject"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                    }
                    if (ddlcatagory.SelectedValue.Equals("Service Tax"))
                    {
                        ServiceTax_GetAllTableAdapter index = new ServiceTax_GetAllTableAdapter();
                        DataTable dtActs = index.SelectAllSTById(id);
                        if (dtActs.Rows.Count > 0)
                        {
                            if (ddlsubcategory.SelectedValue.Equals("Act 1994") || ddlsubcategory.SelectedValue.Equals("ST Rules"))
                            {
                                txtCActsIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtCActsChapterName.Text = dtActs.Rows[0]["ChapterName"].ToString();
                                edtCActsSections.Content = dtActs.Rows[0]["Sections"].ToString();
                                edtCActsSections.Visible = false;
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("Forms and Registers"))
                            {
                                ddlCformsgroup.SelectedValue = dtActs.Rows[0]["Headings"].ToString();
                                ddlCformsgroup_SelectedIndexChanged(ddlCformsgroup, EventArgs.Empty);
                                ddlCformssubgroups.SelectedValue = dtActs.Rows[0]["SubHeadings"].ToString();
                                txtCFormsIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtFormsSubject.Text = dtActs.Rows[0]["Subjects"].ToString();
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                            if (ddlsubcategory.SelectedValue.Equals("Accounting Codes for new services"))
                            {
                                txtCActsIndex.Text = dtActs.Rows[0]["IndexName"].ToString();
                                txtCActsChapterName.Text = dtActs.Rows[0]["ChapterName"].ToString();
                                edtCActsSections.Content = dtActs.Rows[0]["Sections"].ToString();
                                edtCActsSections.Visible = false;
                                bool isdoc = dtActs.Rows[0]["Data"] != null && dtActs.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtActs.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }

                        }
                        //if (ddlsubcategory.SelectedValue.Equals("Case Laws"))
                        //{
                        //    STCaselaws_GetAllTableAdapter indexTariff = new STCaselaws_GetAllTableAdapter();
                        //    DataTable dtTariff = indexTariff.SelectSTCaseLawsById(id);
                        //    if (dtTariff.Rows.Count > 0)
                        //    {
                        //        txtSTCaselaws.Text = dtTariff.Rows[0]["IndexName"].ToString();
                        //        bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                        //        rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                        //        rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                        //        edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                        //        lbshowDoc.Visible = !isdoc;
                        //    }
                        //}
                        if (ddlsubcategory.SelectedValue.Equals("Notifications"))
                        {
                            STN_GetAllTableAdapter indexTariff = new STN_GetAllTableAdapter();
                            DataTable dtTariff = indexTariff.GetAllSTNById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                txtSTNYear.Text = dtTariff.Rows[0]["Year"].ToString();
                                txtSTNFNumber.Text = dtTariff.Rows[0]["FileNumber"].ToString();
                                txtSTNDate.Text = dtTariff.Rows[0]["Date"].ToString();
                                txtSTNSubject.Text = dtTariff.Rows[0]["Subject"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                        if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions"))
                        {
                            Circulars_Info_ByyearTableAdapter indexTariff = new Circulars_Info_ByyearTableAdapter();
                            DataTable dtTariff = indexTariff.GetCEcircularsById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                bool isCircular = dtTariff.Rows[0]["GroupType"].ToString().Equals("Circulars");
                                rdbCircularUploadType.SelectedValue = isCircular ? "Circulars" : "Instructions";
                                txtCircularYear.Text = dtTariff.Rows[0]["Year"].ToString();
                                txtCircularNumber.Text = dtTariff.Rows[0]["CircularNumber"].ToString();
                                txtCircularFileNumber.Text = dtTariff.Rows[0]["FileNumber"].ToString();
                                txtCircularDate.Text = dtTariff.Rows[0]["Date"].ToString();
                                txtCircularSubject.Text = dtTariff.Rows[0]["Subject"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                    }
                    if (ddlcatagory.SelectedValue.Equals("Income Tax"))
                    {
                        if (ddlsubcategory.SelectedValue.Equals("Acts"))
                        {
                            IncomeTaxActs_SelectAllTableAdapter indexTariff = new IncomeTaxActs_SelectAllTableAdapter();
                            DataTable dtTariff = indexTariff.GetITActsById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                ddlITActType.SelectedValue = dtTariff.Rows[0]["SubCategory"].ToString();
                                ddlITActType_SelectedIndexChanged(ddlITActType, EventArgs.Empty);
                                if (ddlITActType.SelectedValue.Equals("Income Tax Act") || ddlITActType.SelectedValue.Equals("Wealth Tax Act") || ddlITActType.SelectedValue.Equals("Expenditure Tax Act"))
                                {
                                    txtSectionNo.Text = dtTariff.Rows[0]["SectionNo"].ToString();
                                    txtSectionName.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                }
                                else
                                {
                                    ddlGroup.SelectedValue = dtTariff.Rows[0]["Groups"].ToString();
                                    txtHeadings.Text = dtTariff.Rows[0]["IndexName"].ToString();

                                }
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }

                        }
                        if (ddlsubcategory.SelectedValue.Equals("Rules"))
                        {
                            IncomeTaxRules_SelectAllTableAdapter indexTariff = new IncomeTaxRules_SelectAllTableAdapter();
                            DataTable dtTariff = indexTariff.GetITRulesById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                ddlITActType.SelectedValue = dtTariff.Rows[0]["SubCategory"].ToString();
                                ddlITActType_SelectedIndexChanged(ddlITActType, EventArgs.Empty);
                                if (ddlITActType.SelectedValue.Equals("Income Tax Rules"))
                                {
                                    txtSectionNo.Text = dtTariff.Rows[0]["SectionNo"].ToString();
                                    txtSectionName.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                }
                                else
                                {
                                    txtHeadings.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                }
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                        if (ddlsubcategory.SelectedValue.Equals("Circulars") || ddlsubcategory.SelectedValue.Equals("Notifications"))
                        {
                            IncomeTaxCircularsNotification_SelectAllTableAdapter indexTariff = new IncomeTaxCircularsNotification_SelectAllTableAdapter();
                            DataTable dtTariff = indexTariff.GetITCNById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                txtITCircularNo.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                txtITCircularDate.Text = dtTariff.Rows[0]["datetime1"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }

                    }
                    if (ddlcatagory.SelectedValue.Equals("DGFT"))
                    {
                        if (ddlsubcategory.SelectedValue.Equals("FTP"))
                        {
                            DGFT_GetAllTableAdapter indexTariff = new DGFT_GetAllTableAdapter();
                            DataTable dtTariff = indexTariff.GetDGFTById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                txtDGFTFTPchaptername.Text = dtTariff.Rows[0]["ChapterName"].ToString();
                                txtpnlDGFTFTPindex.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                txtDGFTFTPsubject.Text = dtTariff.Rows[0]["Sections"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }

                        }
                        if (ddlsubcategory.SelectedValue.Equals("FTDR Notifications"))
                        {
                            DGFT_GetAllTableAdapter indexTariff = new DGFT_GetAllTableAdapter();
                            DataTable dtTariff = indexTariff.GetDGFTById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                txtDGFTFTDRindex.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }
                        if (ddlsubcategory.SelectedValue.Equals("public notices"))
                        {
                            DGFTpublicnotices_GETALLTableAdapter indexTariff = new DGFTpublicnotices_GETALLTableAdapter();
                            DataTable dtTariff = indexTariff.GetAllDgftPNById(id);
                            if (dtTariff.Rows.Count > 0)
                            {
                                txtDGFTpublicnoticeindex.Text = dtTariff.Rows[0]["IndexName"].ToString();
                                txtDGFTpublicnoticenum.Text = dtTariff.Rows[0]["NoticeNumber"].ToString();
                                txtDGFTpublicnoticedate.Text = dtTariff.Rows[0]["Date"].ToString();
                                txtDGFTpublicnoticesubject.Text = dtTariff.Rows[0]["Subject"].ToString();
                                bool isdoc = dtTariff.Rows[0]["Data"] != null && dtTariff.Rows[0]["Data"].ToString().Length > 0;
                                rdbUploadType.SelectedValue = isdoc ? "Paste the Document" : "Upload the Document";
                                rblUploadType_SelectedIndexChanged(rdbUploadType, EventArgs.Empty);
                                edtData.Content = dtTariff.Rows[0]["Data"].ToString();
                                lbshowDoc.Visible = !isdoc;
                            }
                        }

                    }
                }
            }
        }
        public void STNotifications()
        {
            if (rdbUploadType.SelectedValue == "Upload the Document")
            {
                UploadPDF();
            }

            STN_GetAllTableAdapter insertSTN = new STN_GetAllTableAdapter();
            if (hdnId.Value.Length > 0)
            {
                int? id = Int32.Parse(hdnId.Value);
                if (bytes != null && bytes.Length > 1)
                {
                    insertSTN.UpdateSTNById(ddlsubcategory.SelectedValue, txtSTNYear.Text, txtSTNFNumber.Text, txtSTNDate.Text, txtSTNSubject.Text, edtData.Content, bytes, id);
                }
                else
                {
                    insertSTN.UpdateSTNByIdNoDoc(ddlsubcategory.SelectedValue, txtSTNYear.Text, txtSTNFNumber.Text, txtSTNDate.Text, txtSTNSubject.Text, edtData.Content, id);
                }
                Server.Transfer("editnotifications.aspx");
            }
            else
            {
                insertSTN.STN_Insert(ddlsubcategory.SelectedValue, txtSTNYear.Text, txtSTNFNumber.Text, txtSTNDate.Text, txtSTNSubject.Text, edtData.Content, bytes);
            }
        }
 protected void lbshowDoc_Click(object sender, EventArgs e)
 {
     int? id = Int32.Parse(hdnId.Value);
     if (ddlcatagory.SelectedValue.Equals("Central Excise"))
     {
         if (ddlsubcategory.SelectedValue.Equals("Tariff 2012-13"))
         {
             CentralExcise_Tariff_GetAllTableAdapter indexTariff = new CentralExcise_Tariff_GetAllTableAdapter();
             DataTable dataTariff = indexTariff.SelectAllById(id);
             if (dataTariff.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dataTariff.Rows[0]["Document"]);
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions"))
         {
             Circulars_Info_ByyearTableAdapter index = new Circulars_Info_ByyearTableAdapter();
             DataTable dtActs = index.GetCEcircularsById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else
         {
             CEActsTableAdapter index = new CEActsTableAdapter();
             DataTable dtActs = index.CEGetAllById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
     }
     if (ddlcatagory.SelectedValue.Equals("Customs"))
     {
         if (ddlsubcategory.SelectedValue.Equals("Tariff 2012-13"))
         {
             Custom_Tariff_GetAllTableAdapter indexTariff = new Custom_Tariff_GetAllTableAdapter();
             DataTable dataTariff = indexTariff.SelectCustomTariffById(id);
             if (dataTariff.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dataTariff.Rows[0]["Document"]);
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions"))
         {
             Circulars_Info_ByyearTableAdapter index = new Circulars_Info_ByyearTableAdapter();
             DataTable dtActs = index.GetCEcircularsById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else
         {
             ActsTableAdapter index = new ActsTableAdapter();
             DataTable dtActs = index.GetAllCustomsById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
     }
     if (ddlcatagory.SelectedValue.Equals("Service Tax"))
     {
         if (ddlsubcategory.SelectedValue.Equals("Case Laws"))
         {
             STCaselaws_GetAllTableAdapter indexTariff = new STCaselaws_GetAllTableAdapter();
             DataTable dataTariff = indexTariff.SelectSTCaseLawsById(id);
             if (dataTariff.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dataTariff.Rows[0]["Document"]);
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else if (ddlsubcategory.SelectedValue.Equals("Notifications"))
         {
             STN_GetAllTableAdapter index = new STN_GetAllTableAdapter();
             DataTable dtActs = index.GetAllSTNById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else if (ddlsubcategory.SelectedValue.Equals("Circulars/Instructions"))
         {
             Circulars_Info_ByyearTableAdapter index = new Circulars_Info_ByyearTableAdapter();
             DataTable dtActs = index.GetCEcircularsById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else
         {
             ServiceTax_GetAllTableAdapter index = new ServiceTax_GetAllTableAdapter();
             DataTable dtActs = index.SelectAllSTById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
     }
     if (ddlcatagory.SelectedValue.Equals("Income Tax"))
     {
         if (ddlsubcategory.SelectedValue.Equals("Acts"))
         {
             IncomeTaxActs_SelectAllTableAdapter indexTariff = new IncomeTaxActs_SelectAllTableAdapter();
             DataTable dataTariff = indexTariff.GetITActsById(id);
             if (dataTariff.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dataTariff.Rows[0]["Document"]);
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else if (ddlsubcategory.SelectedValue.Equals("Rules"))
         {
             IncomeTaxRules_SelectAllTableAdapter index = new IncomeTaxRules_SelectAllTableAdapter();
             DataTable dtActs = index.GetITRulesById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else
         {
             IncomeTaxCircularsNotification_SelectAllTableAdapter index = new IncomeTaxCircularsNotification_SelectAllTableAdapter();
             DataTable dtActs = index.GetITCNById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
     }
     if (ddlcatagory.SelectedValue.Equals("DGFT"))
     {
         if (ddlsubcategory.SelectedValue.Equals("public notices"))
         {
             DGFTpublicnotices_GETALLTableAdapter indexTariff = new DGFTpublicnotices_GETALLTableAdapter();
             DataTable dataTariff = indexTariff.GetAllDgftPNById(id);
             if (dataTariff.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dataTariff.Rows[0]["Document"]);
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
         else
         {
             DGFT_GetAllTableAdapter index = new DGFT_GetAllTableAdapter();
             DataTable dtActs = index.GetDGFTById(id);
             if (dtActs.Rows.Count > 0)
             {
                 byte[] b = ((byte[])dtActs.Rows[0]["Document"]);
                 //Collect Bytes from database and write in Webpage
                 Response.ContentType = "application/pdf";
                 Response.BinaryWrite(b);
             }
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["subcat"] == "Circulars/Instructions")
            {
                category = Request.QueryString["cat"].Replace("/", " ");
                subcategory = Request.QueryString["subcat"];
            }
            else if (Request.QueryString["subcat"] == "Case/Laws")
            {
                category = Request.QueryString["cat"].Replace("/", " ");
                subcategory = Request.QueryString["subcat"].Replace("/", " ");
                lblAgreements.Text = category + " " + subcategory;
            }

            else
            {
                category = Request.QueryString["cat"].Replace("/", " ");
                subcategory = Request.QueryString["subcat"].Replace("/", " ");
            }

            #region Circulars/Instructions
            if (subcategory == "Circulars/Instructions" & category != "")
            {
                group = subcategory.Split('/');

                if (group[0].Equals("Circulars"))
                {
                    Circulars_Index_selectTableAdapter circularIndex = new Circulars_Index_selectTableAdapter();
                    DataTable dtcircularsIndex = circularIndex.Circulars_Index(category);
                    if (dtcircularsIndex.Rows.Count > 0)
                    {
                        dlIndexCirculars.DataSource = dtcircularsIndex;
                        dlIndexCirculars.DataBind();
                    }

                    if (group[1].Equals("Instructions"))
                    {
                        Instructors_Index_selectTableAdapter instructorsIndex = new Instructors_Index_selectTableAdapter();
                        DataTable dtinstructorsIndex = instructorsIndex.Instructors_Index(category);
                        if (dtinstructorsIndex.Rows.Count > 0)
                        {
                            dlIndexInstrcutions.DataSource = dtinstructorsIndex;
                            dlIndexInstrcutions.DataBind();
                        }
                    }
                }
                InvisibleRuleLabels();
                InvisibleFormLabels();
                dlIndex.Visible = true;
                //invisible rules
                dlAgreements.Visible = false;
                dlBaggage.Visible = false;
                dlCustomDrawBack.Visible = false;
                dlCustomValuation.Visible = false;
                dlOthers.Visible = false;
                //invisible forms
                dlRefunds.Visible = false;
                dlAppeals.Visible = false;
                dlDrawback.Visible = false;
                dlOthersApplicationForms.Visible = false;
                dlShipping.Visible = false;
                dllBill.Visible = false;
                dlBonds.Visible = false;
                dlSettlementCommission.Visible = false;
                dlSTCaseLaws.Visible = false;
                dlDGFT.Visible = false;

                //invisible SEZ
                gvSEZ.Visible = false;
                //invisible ServiceTax
                gvservicetaxforms.Visible = false;
                gvstacts.Visible = false;
                gvstrules.Visible = false;
                dtstaccodes.Visible = false;
                dlITActs.Visible = false;
                pnlITActsGift.Visible = false;
                pnlITActsInterest.Visible = false;
                dlantidumpingduty.Visible = false;
                pnlSION.Visible = false;
                //visible Circular/Instruction Headings
                if (category == "DGFT")
                {
                    lblInstructionHeading.Visible = false;

                }
                else
                {
                    lblInstructionHeading.Visible = true;
                }

                lblCircularHeading.Visible = true;

                pnlSTlibraries.Visible = false;
                pnlSTTaxation.Visible = false;
                pnlCEManual.Visible = false;
                dltariff.Visible = false;
                dlnontariff.Visible = false;
                dlsafeguards.Visible = false;
                dlCECothers.Visible = false;
                dlSTN.Visible = false;

            }
            #endregion
            else
            {
                if (category == "Customs")
                {
                    #region CustomsIndex

                    if (category == "Customs" & subcategory == "Rules")
                    {
                        VisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = false;
                        //visible rules
                        dlAgreements.Visible = true;
                        dlBaggage.Visible = true;
                        dlCustomDrawBack.Visible = true;
                        dlCustomValuation.Visible = true;
                        dlOthers.Visible = true;
                        //invisible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlDGFT.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        //invisible ServiceTax
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        lblAgreements.Text = "Agreements between nations";
                        lblBaggage.Text = "Baggage Rules, 1998";

                        ActsTableAdapter indexByHeadings = new ActsTableAdapter();
                        DataTable dtAgreements = indexByHeadings.GetIndexbyRulesHeadings(subcategory, "Agreements between nations");
                        dlAgreements.DataSource = dtAgreements;
                        dlAgreements.DataBind();

                        DataTable dtBaggage = indexByHeadings.GetIndexbyRulesHeadings(subcategory, "Baggage Rules, 1998");
                        dlBaggage.DataSource = dtBaggage;
                        dlBaggage.DataBind();

                        DataTable dtCustomDrawBack = indexByHeadings.GetIndexbyRulesHeadings(subcategory, "Customs Drawback Rules");
                        dlCustomDrawBack.DataSource = dtCustomDrawBack;
                        dlCustomDrawBack.DataBind();

                        DataTable dtCustomValuation = indexByHeadings.GetIndexbyRulesHeadings(subcategory, "Customs Valuation Rules");
                        dlCustomValuation.DataSource = dtCustomValuation;
                        dlCustomValuation.DataBind();

                        DataTable dtOthers = indexByHeadings.GetIndexbyRulesHeadings(subcategory, "Others");
                        dlOthers.DataSource = dtOthers;
                        dlOthers.DataBind();
                    }
                    else if (category == "Customs" & subcategory == "Forms")
                    {
                        InvisibleRuleLabels();
                        VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = true;
                        dlAppeals.Visible = true;
                        dlDrawback.Visible = true;
                        dlOthersApplicationForms.Visible = true;
                        dlShipping.Visible = true;
                        dllBill.Visible = true;
                        dlBonds.Visible = true;
                        dlDGFT.Visible = false;
                        dlSettlementCommission.Visible = true;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        ActsTableAdapter indexByHeadings = new ActsTableAdapter();

                        DataTable dtRefunds = indexByHeadings.GetIndexbyFormsHeadings(subcategory, "Application Forms", "Refunds");
                        dlRefunds.DataSource = dtRefunds;
                        dlRefunds.DataBind();

                        DataTable dtAppeals = indexByHeadings.GetIndexbyFormsHeadings(subcategory, "Application Forms", "Appeals");
                        dlAppeals.DataSource = dtAppeals;
                        dlAppeals.DataBind();

                        DataTable dtDrawback = indexByHeadings.GetIndexbyFormsHeadings(subcategory, "Application Forms", "Drawback");
                        dlDrawback.DataSource = dtDrawback;
                        dlDrawback.DataBind();

                        DataTable dtOthersApplicationForms = indexByHeadings.GetIndexbyFormsHeadings(subcategory, "Application Forms", "Others");
                        dlOthersApplicationForms.DataSource = dtOthersApplicationForms;
                        dlOthersApplicationForms.DataBind();

                        DataTable dtShipping = indexByHeadings.GetIndexbyFormsHeadings(subcategory, "Shipping Bill Forms", "");
                        dlShipping.DataSource = dtShipping;
                        dlShipping.DataBind();

                        DataTable dtBill = indexByHeadings.GetIndexbyFormsHeadings(subcategory, "Bill of Entry Forms", "");
                        dllBill.DataSource = dtBill;
                        dllBill.DataBind();

                        DataTable dtBonds = indexByHeadings.GetIndexbyFormsHeadings(subcategory, "Bonds", "");
                        dlBonds.DataSource = dtBonds;
                        dlBonds.DataBind();

                        DataTable dtSettlementCommission = indexByHeadings.GetIndexbyFormsHeadings(subcategory, "Settlement Commission", "");
                        dlSettlementCommission.DataSource = dtSettlementCommission;
                        dlSettlementCommission.DataBind();
                    }
                    else if (category == "Customs" & subcategory == "SEZ")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        //invisible all
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlDGFT.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //visible SEZ
                        gvSEZ.Visible = true;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        ActsTableAdapter index = new ActsTableAdapter();
                        DataTable dtSEZ = index.SEZ_Index(subcategory);
                        gvSEZ.DataSource = dtSEZ;
                        gvSEZ.DataBind();
                    }
                    else if (category == "Customs" & subcategory == "Tariff 2012-13")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        //invisible all
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        dlDGFT.Visible = false;
                        //visible SEZ
                        gvSEZ.Visible = true;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlCEManual.Visible = false;
                        pnlSTTaxation.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        DataTable dtGroups = new DataTable();
                        DataRow row = null;

                        DataColumn dcRelationShip = new DataColumn("Group");
                        dcRelationShip.DataType = System.Type.GetType("System.String");
                        dtGroups.Columns.Add(dcRelationShip);
                        row = dtGroups.NewRow();
                        row["Group"] = "General Notes";
                        dtGroups.Rows.Add(row);
                        row = dtGroups.NewRow();
                        row["Group"] = "Import Tariff";
                        dtGroups.Rows.Add(row);
                        row = dtGroups.NewRow();
                        row["Group"] = "General Exemptions";
                        dtGroups.Rows.Add(row);
                        row = dtGroups.NewRow();
                        row["Group"] = "The Second Schedule Export Tariff";
                        dtGroups.Rows.Add(row);
                        row = dtGroups.NewRow();
                        row["Group"] = "Anti Dumping Duty Notifications";
                        dtGroups.Rows.Add(row);
                        row = dtGroups.NewRow();
                        row["Group"] = "Appendix";
                        dtGroups.Rows.Add(row);
                        string redirect = string.Empty;
                        Custom_Tariff_IndexnameTableAdapter index = new Custom_Tariff_IndexnameTableAdapter();

                        ltlIndex.Text = "<table>";
                        foreach (DataRow drGroups in dtGroups.Rows)
                        {
                            string groupName = drGroups[0].ToString();
                            DataTable dtIndex = index.Custom_Tariff_IndexbyGroup(groupName);

                            if (dtIndex.Rows.Count > 0)
                            {
                                string name = string.Empty;
                                string _indexName = string.Empty;
                                foreach (DataRow drIndex in dtIndex.Rows)
                                {
                                    bool isDoc = false;
                                    string indexname = drIndex["indexname"].ToString();
                                    DataTable dtChapterbyIndex = index.GetCustomTariffByIndex(indexname);
                                    if (dtChapterbyIndex.Rows.Count > 0)
                                    {
                                        string aChapter = Convert.ToString(dtChapterbyIndex.Rows[0]["chaptername"]);
                                        if (aChapter.Equals(""))
                                        {
                                            string adata = Convert.ToString(dtChapterbyIndex.Rows[0]["data"]);
                                            isDoc = adata.Equals("");
                                            redirect = "shownotifications.aspx";
                                        }
                                        else
                                        {
                                            redirect = "displayindex.aspx";
                                        }
                                    }

                                    string chapatername = drIndex["chaptername"].ToString();
                                    if (name != groupName)
                                    {
                                        ltlIndex.Text += "<tr><td colspan='2' align='center' style='background-color:#D9D9D9;font-size:1.4em;'>";
                                        ltlIndex.Text += "<b>" + groupName + "</b></td></tr>";
                                    }
                                    ltlIndex.Text += "<tr><td width='200' valign='top'>";
                                    if (_indexName != indexname)
                                    {
                                        ltlIndex.Text += "<br/><a href='" + redirect + "?cat=" + category + "&subcat=" + subcategory + "&name=" + drIndex["indexname"].ToString() + (isDoc ? "' target='_blank'" : string.Empty) + "'>" + drIndex["indexname"].ToString() + "</a>";
                                    }

                                    if (chapatername == "")
                                    {
                                        ltlIndex.Text += "</td><td><br/>" + drIndex["subjects"].ToString() + "<br/></td></tr>";
                                    }
                                    name = groupName;
                                    _indexName = indexname;
                                }
                            }
                        }
                        ltlIndex.Text += "</table>";
                    }

                    else if (category == "Customs" & subcategory == "Notifications")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = true;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        dlDGFT.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = true;
                        dlnontariff.Visible = true;
                        dlsafeguards.Visible = true;
                        dlCECothers.Visible = true;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        CECNotifications();

                    }
                    else if (category == "Customs" & subcategory == "Acts" || subcategory == "Regulations" || subcategory == "Drawback Schedule")
                    {

                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = true;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        dlDGFT.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        ActsTableAdapter actsIndexName = new ActsTableAdapter();
                        DataTable dtActsIndexName = actsIndexName.Index_Select(subcategory);
                        if (dtActsIndexName.Rows.Count > 0)
                        {
                            dlIndex.DataSource = dtActsIndexName;
                            dlIndex.DataBind();
                        }
                    }

                    else
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        dlDGFT.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        GetAllCaseLawsTableAdapter CLyear = new GetAllCaseLawsTableAdapter();
                        DataTable dtCLyear = CLyear.GetYearsByCategory(category);
                        if (dtCLyear.Rows.Count > 0)
                        {
                            ltlCaselwas.Text = string.Empty;

                            foreach (DataRow CL in dtCLyear.Rows)
                            {
                                int CLuniqueyear=(int)CL["Year"];
                                GetAllCaseLawsTableAdapter CLNumber = new GetAllCaseLawsTableAdapter();
                                DataTable dtCLNumber = CLyear.GetCLNumByYear(category, CLuniqueyear);
                                if(dtCLNumber.Rows.Count>0)

                                {
                                    string CLmaxNumberforyears = dtCLNumber.Rows[0]["maxclnum"].ToString();

                                    int CLmaxNumberforyear = Convert.ToInt32(CLmaxNumberforyears);

                                    if (CLmaxNumberforyear > 0)
                                    {
                                        int c = 1, i = 0, d = 50;
                                        ltlCaselwas.Text += "<table class='citation'><tr><th colspan='3' align='center'>Citation of Year&nbsp;" + CLuniqueyear + "</th></tr><tr>";
                                        for (int v = CLmaxNumberforyear; v > 0; )
                                        {
                                            v = v - 50;
                                            ltlCaselwas.Text += "<td align='center'><a href=displayindex.aspx?CLnum1=" + d + "&CLnum2=" + c + "&year=" + CLuniqueyear + "&cat=" + category + "&subcat=" + subcategory + ">" + c + "-" + d + "</a></td>";
                                            c = c + 50;
                                            if (++i % 3 == 0)
                                            {
                                                ltlCaselwas.Text += "</tr><tr>";
                                            }
                                            d = d + 50;
                                        }
                                        ltlCaselwas.Text += "</tr>";
                                        ltlCaselwas.Text += "</table><br/><br/>";
                                    }

                            }
                            }

                        }
                    }
                    #endregion
                }
                if (category == "Central Excise")
                {
                    #region CentralExciseIndex
                    if (category == "Central Excise" & subcategory == "Rules")
                    {
                        VisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = false;
                        //visible rules
                        dlAgreements.Visible = true;
                        dlBaggage.Visible = true;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDGFT.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        pnlCEManual.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;

                        lblAgreements.Text = "Central Excise Rules";
                        lblBaggage.Text = string.Empty;
                        lblCustomDrawBack.Visible = false;
                        lblCustomValuation.Visible = false;
                        lblOthers.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;
                        CEActsTableAdapter indexByHeadings = new CEActsTableAdapter();
                        DataTable dtAgreements = indexByHeadings.IndexByHeadings(subcategory, "Central Excise Rules");
                        dlAgreements.DataSource = dtAgreements;
                        dlAgreements.DataBind();

                        DataTable dtBaggage = indexByHeadings.IndexByHeadings(subcategory, "Rescinded or Superseded Rules");
                        dlBaggage.DataSource = dtBaggage;
                        dlBaggage.DataBind();
                    }
                    else if (category == "Central Excise" & subcategory == "Forms")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        //invisible all
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlDGFT.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //visible SEZ
                        gvSEZ.Visible = true;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        CEActsTableAdapter index = new CEActsTableAdapter();
                        DataTable dtForms = index.CEForms(subcategory);
                        gvSEZ.DataSource = dtForms;
                        gvSEZ.DataBind();
                    }

                    else if (category == "Central Excise" & subcategory == "Tariff 2012-13")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        //invisible all
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlDGFT.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //visible SEZ
                        gvSEZ.Visible = true;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;
                        DataTable dtGroups = new DataTable();
                        DataRow row = null;

                        DataColumn dcRelationShip = new DataColumn("Group");
                        dcRelationShip.DataType = System.Type.GetType("System.String");
                        dtGroups.Columns.Add(dcRelationShip);
                        row = dtGroups.NewRow();
                        row["Group"] = "General Excise Act";
                        dtGroups.Rows.Add(row);
                        row = dtGroups.NewRow();
                        row["Group"] = "Central Excise Tariff Act, 1985 and Exemption Notifications";
                        dtGroups.Rows.Add(row);
                        row = dtGroups.NewRow();
                        row["Group"] = "General Exemptions";
                        dtGroups.Rows.Add(row);
                        row = dtGroups.NewRow();
                        row["Group"] = "Appendix";
                        dtGroups.Rows.Add(row);
                        string redirect = string.Empty;
                        CentralExcise_Tariff_GetAllTableAdapter index = new CentralExcise_Tariff_GetAllTableAdapter();

                        ltlIndex.Text = "<table>";
                        foreach (DataRow drGroups in dtGroups.Rows)
                        {
                            string groupName = drGroups[0].ToString();
                            DataTable dtIndex = index.CE_Tariff_IndexByGroup(groupName);

                            if (dtIndex.Rows.Count > 0)
                            {
                                string name = string.Empty;
                                string _indexName = string.Empty;

                                foreach (DataRow drIndex in dtIndex.Rows)
                                {
                                    bool isDoc = false;
                                    string indexname = drIndex["indexname"].ToString();
                                    DataTable dtChapterbyIndex = index.CE_Tariff_ChapterByIndex(indexname);
                                    if (dtChapterbyIndex.Rows.Count > 0)
                                    {
                                        string aChapter = Convert.ToString(dtChapterbyIndex.Rows[0]["chaptername"]);
                                        if (aChapter.Equals(""))
                                        {
                                            string adata = Convert.ToString(dtChapterbyIndex.Rows[0]["data"]);
                                            isDoc = adata.Equals("");
                                            redirect = "shownotifications.aspx";
                                        }
                                        else
                                        {
                                            redirect = "displayindex.aspx";
                                        }
                                    }

                                    string chapatername = drIndex["chaptername"].ToString();
                                    if (name != groupName)
                                    {
                                        ltlIndex.Text += "<tr><td colspan='2' align='center' style='background-color:#D9D9D9;font-size:1.4em;'>";
                                        ltlIndex.Text += "<b>" + groupName + "</b></td></tr>";
                                    }
                                    ltlIndex.Text += "<tr><td width='100' valign='top'>";
                                    if (_indexName != indexname)
                                    {
                                        ltlIndex.Text += "<br/><a href='" + redirect + "?cat=" + category + "&subcat=" + subcategory + "&name=" + drIndex["indexname"].ToString() + (isDoc ? "' target='_blank'" : string.Empty) + "'>" + drIndex["indexname"].ToString() + "</a>";
                                    }

                                    if (chapatername == "")
                                    {
                                        ltlIndex.Text += "</td><td><br/>" + drIndex["subjects"].ToString() + "<br/></td></tr>";
                                    }
                                    name = groupName;
                                    _indexName = indexname;
                                }
                            }
                        }
                        ltlIndex.Text += "</table>";
                    }
                    else if (category == "Central Excise" & subcategory == "CBEC Manual")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        //invisible all
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlDGFT.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //visible SEZ
                        gvSEZ.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = true;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;
                    }
                    else if (category == "Central Excise" & subcategory == "Notifications")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = true;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlDGFT.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = true;
                        dlnontariff.Visible = true;
                        dlsafeguards.Visible = true;
                        dlCECothers.Visible = true;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = true;
                        pnlSION.Visible = false;
                        CECNotifications();
                    }

                    else  if (category == "Central Excise" & subcategory == "Case Laws" || subcategory == "Case")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        dlDGFT.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlSION.Visible = false;
                        GetAllCaseLawsTableAdapter CLyear = new GetAllCaseLawsTableAdapter();
                        DataTable dtCLyear = CLyear.GetYearsByCategory(category);
                        if (dtCLyear.Rows.Count > 0)
                        {
                            ltlCaselwas.Text = string.Empty;

                            foreach (DataRow CL in dtCLyear.Rows)
                            {
                                int CLuniqueyear = (int)CL["Year"];
                                GetAllCaseLawsTableAdapter CLNumber = new GetAllCaseLawsTableAdapter();
                                DataTable dtCLNumber = CLyear.GetCLNumByYear(category, CLuniqueyear);
                                if (dtCLNumber.Rows.Count > 0)
                                {
                                    string CLmaxNumberforyears = dtCLNumber.Rows[0]["maxclnum"].ToString();

                                    int CLmaxNumberforyear = Convert.ToInt32(CLmaxNumberforyears);

                                    if (CLmaxNumberforyear > 0)
                                    {
                                        int c = 1,i=0, d = 50;
                                        ltlCaselwas.Text += "<table class='citation'><tr><th colspan='3' align='center'>Citation of Year&nbsp;" + CLuniqueyear + "</th></tr><tr>";
                                        for (int v = CLmaxNumberforyear; v > 0; )
                                        {
                                            v = v - 50;
                                            ltlCaselwas.Text += "<td align='center'><a href=displayindex.aspx?CLnum1=" + d + "&CLnum2=" + c + "&year=" + CLuniqueyear + "&cat=Central%20Excise&subcat=Case%20Laws>" + c + "-" + d + "</a></td>";
                                            if (++i % 3 == 0)
                                            {
                                                ltlCaselwas.Text += "</tr><tr>";
                                            }
                                            c = c + 50;
                                            d = d + 50;
                                        }
                                        ltlCaselwas.Text += "</tr>";
                                        ltlCaselwas.Text += "</table><br/><br/>";

                                    }

                                }
                            }

                        }

                    }

                    else
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = true;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlDGFT.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false; dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;
                        CEActsTableAdapter index = new CEActsTableAdapter();
                        DataTable dtActsIndexName = index.CEIndex(subcategory);
                        if (dtActsIndexName.Rows.Count > 0)
                        {
                            dlIndex.DataSource = dtActsIndexName;
                            dlIndex.DataBind();
                        }
                    }

                    #endregion
                }
                if (category == "Service Tax")
                {
                    #region ServiceTax
                    if (category == "Service Tax" & subcategory == "Act 1994")
                    {
                        InvisibleFormLabels();
                        dlIndex.Visible = false;
                        //visible rules
                        dlAgreements.Visible = false;
                        gvstacts.Visible = true;
                        //  dlBaggage.Visible = true;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlDGFT.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        pnlCEManual.Visible = false;

                        // lblAgreements.Text = "Central Excise Rules";
                        // lblBaggage.Text = "Rescinded or Superseded Rules";
                        lblCustomDrawBack.Visible = false;
                        lblCustomValuation.Visible = false;
                        lblOthers.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;

                        ServiceTax_GetAll1TableAdapter index = new ServiceTax_GetAll1TableAdapter();

                        DataTable dtIndex = index.STAct_Index_Select(subcategory);
                        dtIndex.Columns.Add("IsDoc");
                        foreach (DataRow dr in dtIndex.Rows)
                        {
                            dr["IsDoc"] = dr["Data"] == null || dr["Data"].ToString() == string.Empty;
                        }
                        gvstacts.DataSource = dtIndex;
                        gvstacts.DataBind();

                    }
                    else if (category == "Service Tax" & subcategory == "ST Rules")
                    {
                        InvisibleRuleLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        gvstrules.Visible = true;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlDGFT.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;

                        //invisible SEZ
                        gvSEZ.Visible = false;

                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        pnlSION.Visible = false;
                        ServiceTax_GetAll1TableAdapter indexrules = new ServiceTax_GetAll1TableAdapter();

                        DataTable dtIndex = indexrules.STRules_Index_Select(subcategory);
                        dtIndex.Columns.Add("IsDoc");
                        foreach (DataRow dr in dtIndex.Rows)
                        {
                            dr["IsDoc"] = dr["Data"] == null || dr["Data"].ToString() == string.Empty;
                        }
                        gvstrules.DataSource = dtIndex;
                        gvstrules.DataBind();
                    }
                    else if (category == "Service Tax" & subcategory == "Forms and Registers")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        //invisible all
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlDGFT.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //visible SEZ
                        gvSEZ.Visible = false;
                        gvservicetaxforms.Visible = true;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;
                        ServiceTax_GetAll1TableAdapter indexforms = new ServiceTax_GetAll1TableAdapter();

                        DataTable dtIndexForms = indexforms.STForms_Index_Select(subcategory);
                        dtIndexForms.Columns.Add("IsDoc");
                        foreach (DataRow dr in dtIndexForms.Rows)
                        {
                            dr["IsDoc"] = dr["Data"] == null || dr["Data"].ToString() == string.Empty;
                        }
                        gvservicetaxforms.DataSource = dtIndexForms;
                        gvservicetaxforms.DataBind();
                    }
                    else if (category == "Service Tax" & subcategory == "Accounting Codes for new services")
                    {
                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = true;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlDGFT.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;

                        //invisible SEZ
                        gvSEZ.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;

                        ServiceTax_GetAll1TableAdapter indexaccountcodes = new ServiceTax_GetAll1TableAdapter();

                        DataTable dtIndexindexaccountcodes = indexaccountcodes.STAccountcode_Index_Select(subcategory);
                        dtstaccodes.DataSource = dtIndexindexaccountcodes;
                        dtstaccodes.DataBind();
                    }

                    else if (category == "Service Tax" & subcategory == "Case Laws")
                    {
                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = false;
                        dlBaggage.Visible = false;
                        dlDGFT.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;

                        //invisible SEZ
                        gvSEZ.Visible = false;

                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        pnlSION.Visible = false;
                        GetAllCaseLawsTableAdapter CLyear = new GetAllCaseLawsTableAdapter();
                        DataTable dtCLyear = CLyear.GetYearsByCategory(category);
                        if (dtCLyear.Rows.Count > 0)
                        {
                            ltlCaselwas.Text = string.Empty;

                            foreach (DataRow CL in dtCLyear.Rows)
                            {
                                int CLuniqueyear = (int)CL["Year"];
                                GetAllCaseLawsTableAdapter CLNumber = new GetAllCaseLawsTableAdapter();
                                DataTable dtCLNumber = CLyear.GetCLNumByYear(category, CLuniqueyear);
                                if (dtCLNumber.Rows.Count > 0)
                                {
                                    string CLmaxNumberforyears = dtCLNumber.Rows[0]["maxclnum"].ToString();

                                    int CLmaxNumberforyear = Convert.ToInt32(CLmaxNumberforyears);

                                    if (CLmaxNumberforyear > 0)
                                    {
                                        int c = 1, i = 0, d = 50;
                                        ltlCaselwas.Text += "<table class='citation'><tr><th colspan='3' align='center'>Citation of Year&nbsp;" + CLuniqueyear + "</th></tr><tr>";
                                        for (int v = CLmaxNumberforyear; v > 0; )
                                        {
                                            v = v - 50;
                                            ltlCaselwas.Text += "<td align='center'><a href=displayindex.aspx?CLnum1=" + d + "&CLnum2=" + c + "&year=" + CLuniqueyear + "&cat=Service%20Tax&subcat=Case%20Laws>" + c + "-" + d + "</a></td>";
                                            if (++i % 3 == 0)
                                            {
                                                ltlCaselwas.Text += "</tr><tr>";
                                            }
                                            c = c + 50;
                                            d = d + 50;
                                        }
                                        ltlCaselwas.Text += "</tr>";
                                        ltlCaselwas.Text += "</table><br/><br/>";

                                    }

                                }
                            }

                        }

                    }

                    else if (category == "Service Tax" & subcategory == "Taxation of Services An Educational Guide")
                    {
                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlDGFT.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;

                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;

                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = true;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        pnlSION.Visible = false;
                    }
                    else if (category == "Service Tax" & subcategory == "Notifications")
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = true;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = true;
                        dlSTN.Visible = true;
                        pnlITActsInterest.Visible = false;
                        dlantidumpingduty.Visible = true;
                        pnlSION.Visible = false;
                        STN_GetAllTableAdapter styear = new STN_GetAllTableAdapter();
                        DataTable dtstnYear = styear.STN_Index();
                        if (dtstnYear.Rows.Count > 0)
                        {
                            dlSTN.DataSource = dtstnYear;
                            dlSTN.DataBind();
                        }

                    }

                    else
                    {
                        InvisibleRuleLabels();
                        InvisibleFormLabels();
                        dlIndex.Visible = true;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlOthers.Visible = false;
                        //invisible forms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;
                        //invisible ServiceTax Data
                        gvservicetaxforms.Visible = false;
                        gvstacts.Visible = false;
                        gvstrules.Visible = false;
                        dtstaccodes.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;
                        //CEActsTableAdapter index = new CEActsTableAdapter();
                        //DataTable dtActsIndexName = index.CEIndex(subcategory);
                        //if (dtActsIndexName.Rows.Count > 0)
                        //{
                        //    dlIndex.DataSource = dtActsIndexName;
                        //    dlIndex.DataBind();
                        //}
                    }

                    #endregion
                }
                if (category == "Library")
                {

                    #region Library

                    // VisibleRuleLabels();
                    InvisibleFormLabels();
                    dlIndex.Visible = false;
                    //visible rules
                    dlAgreements.Visible = false;
                    dlBaggage.Visible = true;
                    dlCustomDrawBack.Visible = false;
                    dlCustomValuation.Visible = false;
                    dlOthers.Visible = false;
                    //invisible froms
                    dlRefunds.Visible = false;
                    dlAppeals.Visible = false;
                    dlDrawback.Visible = false;
                    dlOthersApplicationForms.Visible = false;
                    dlShipping.Visible = false;
                    dllBill.Visible = false;
                    dlBonds.Visible = false;
                    dlDGFT.Visible = false;
                    dlSettlementCommission.Visible = false;
                    dlSTCaseLaws.Visible = false;
                    //invisible SEZ
                    gvSEZ.Visible = false;
                    //invisible ServiceTax Data
                    gvservicetaxforms.Visible = false;
                    gvstacts.Visible = false;
                    gvstrules.Visible = false;
                    dtstaccodes.Visible = false;
                    pnlCEManual.Visible = false;
                    //invisible Circular/Instruction Headings
                    lblCircularHeading.Visible = false;
                    lblInstructionHeading.Visible = false;

                    lblAgreements.Text = string.Empty;

                    if (subcategory == "Central Excise")
                    {
                        lblBaggage.Text = "Rescinded or Superseded Rules";
                    }
                    if (subcategory == "Service Tax")
                    {
                        lblBaggage.Text = "Service Tax Libraries";
                    }
                    if (subcategory == "Customs")
                    {
                        lblBaggage.Text = "Custom Libraries";
                    }
                    if (subcategory == "Income Tax")
                    {
                        lblBaggage.Text = "Income Tax Libraries";
                    }
                    if (subcategory == "DGFT")
                    {
                        lblBaggage.Text = "DGFT Libraries";
                    }

                    lblCustomDrawBack.Visible = false;
                    lblCustomValuation.Visible = false;
                    lblOthers.Visible = false;
                    pnlSTlibraries.Visible = false;
                    pnlSTTaxation.Visible = false;
                    dlITActs.Visible = false;

                    dltariff.Visible = false;
                    dlnontariff.Visible = false;
                    dlsafeguards.Visible = false;
                    dlCECothers.Visible = false;
                    dlSTN.Visible = false;
                    dlantidumpingduty.Visible = false;
                    pnlSION.Visible = false;
                    pnlITActsGift.Visible = false;
                    pnlITActsInterest.Visible = false;

                    Library_SelectAllTableAdapter indexselect = new Library_SelectAllTableAdapter();
                    DataTable dtBaggage = indexselect.Library_Index_Select(subcategory);

                    // Library_RSRules_SelectAllTableAdapter indexByHeadings = new Library_RSRules_SelectAllTableAdapter();
                    //  DataTable dtBaggage = indexByHeadings.RSRules_Index(subcategory);
                    dlBaggage.DataSource = dtBaggage;
                    dlBaggage.DataBind();
                    #endregion
                }

                if (category == "Income Tax")
                {
                    #region Income Tax
                    if (subcategory == "Income Tax Act" || subcategory == "Wealth Tax Act" || subcategory == "Expenditure Tax Act")
                    {
                        dlITActs.Visible = true;

                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlDGFT.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;

                        //invisible SEZ
                        gvSEZ.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;
                        IncomeTaxActs_SelectAllTableAdapter getITDetails = new IncomeTaxActs_SelectAllTableAdapter();
                        DataTable dtGetITDetails = getITDetails.GetIndex(subcategory);
                        if (dtGetITDetails.Rows.Count > 0)
                        {
                            dtGetITDetails.Columns.Add("IsDoc");
                            foreach (DataRow dr in dtGetITDetails.Rows)
                            {
                                dr["IsDoc"] = "False";
                            }
                            dlITActs.DataSource = dtGetITDetails;
                            dlITActs.DataBind();
                        }
                    }
                    if (subcategory == "Finance Act")
                    {
                        dlITActs.Visible = false;

                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlDGFT.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;

                        pnlSTlibraries.Visible = true;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        pnlSION.Visible = false;
                        IncomeTaxActs_SelectAllTableAdapter getITDetails = new IncomeTaxActs_SelectAllTableAdapter();
                        DataTable dtGetITDetails = getITDetails.GetFinanceActsDetails(subcategory);
                        if (dtGetITDetails.Rows.Count > 0)
                        {
                            ltlIndex.Text = "<table width='100%'>";
                            string _group = string.Empty;
                            string _indexName = string.Empty;
                            foreach (DataRow drGetITDetails in dtGetITDetails.Rows)
                            {
                                string group = drGetITDetails["Groups"].ToString();
                                string indexName = drGetITDetails["IndexName"].ToString();

                                if (_group != group)
                                {
                                    ltlIndex.Text += "<tr height='10px'><td align='center' style='background-color:#D9D9D9;font-size:1.4em;'>" + group + "<br/><br/></td></tr>";
                                }
                                ltlIndex.Text += "<tr><td style='font-size:10.0pt;font-family:Verdana,sans-serif;mso-bidi-font-family:Times'><a href='shownotifications.aspx?name=" + indexName + "+&cat=" + category + "&subcat=" + subcategory + "'>" + indexName + "</a><br/><br/></td></tr>";
                                _group = group;
                            }
                            ltlIndex.Text += "</table>";
                        }
                    }
                    if (subcategory == "Interest Tax Act")
                    {
                        pnlITActsInterest.Visible = true;

                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlDGFT.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        //invisible SEZ
                        gvSEZ.Visible = false;

                        pnlSTlibraries.Visible = true;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        pnlSTlibraries.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlSION.Visible = false;
                    }

                    if (subcategory == "Gift Tax Act")
                    {
                        pnlITActsGift.Visible = true;

                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlDGFT.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;

                        //invisible SEZ
                        gvSEZ.Visible = false;

                        pnlSTlibraries.Visible = true;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        pnlSTlibraries.Visible = false;
                        dlITActs.Visible = false;
                        pnlITActsInterest.Visible = false;
                        pnlSION.Visible = false;

                    }
                    if (subcategory == "Income Tax Rules" || subcategory == "Other Direct Tax Rules")
                    {
                        dlITActs.Visible = true;

                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlDGFT.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;

                        //invisible SEZ
                        gvSEZ.Visible = false;

                        pnlSTlibraries.Visible = true;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        pnlSTlibraries.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;

                        IncomeTaxRules_SelectAllTableAdapter getITDetails = new IncomeTaxRules_SelectAllTableAdapter();
                        DataTable dtGetITDetails = getITDetails.GetIndex(subcategory);
                        if (dtGetITDetails.Rows.Count > 0)
                        {
                            dtGetITDetails.Columns.Add("IsDoc");
                            foreach (DataRow dr in dtGetITDetails.Rows)
                            {
                                dr["IsDoc"] = "False";
                            }
                            dlITActs.DataSource = dtGetITDetails;
                            dlITActs.DataBind();
                        }
                    }
                    if (subcategory == "Circulars" || subcategory == "Notifications")
                    {
                        dlITActs.Visible = true;

                        InvisibleRuleLabels();
                        // VisibleFormLabels();
                        dlIndex.Visible = false;
                        //invisible rules
                        dlAgreements.Visible = false;
                        dtstaccodes.Visible = false;
                        dlBaggage.Visible = false;
                        dlCustomDrawBack.Visible = false;
                        dlCustomValuation.Visible = false;
                        dlDGFT.Visible = false;
                        dlOthers.Visible = false;
                        //visible froms
                        dlRefunds.Visible = false;
                        dlAppeals.Visible = false;
                        dlDrawback.Visible = false;
                        dlOthersApplicationForms.Visible = false;
                        dlShipping.Visible = false;
                        dllBill.Visible = false;
                        dlBonds.Visible = false;
                        dlSettlementCommission.Visible = false;
                        dlSTCaseLaws.Visible = false;

                        lblAppeals.Visible = false;
                        lblApplicationForm.Visible = false;
                        lblBill.Visible = false;
                        lblBonds.Visible = false;

                        lblDrawback.Visible = false;
                        lblOthersApplicationForms.Visible = false;
                        lblRefunds.Visible = false;
                        lblSettlementCommission.Visible = false;
                        lblShipping.Visible = false;
                        //invisible Circular/Instruction Headings
                        lblCircularHeading.Visible = false;
                        lblInstructionHeading.Visible = false;
                        pnlSTlibraries.Visible = false;

                        //invisible SEZ
                        gvSEZ.Visible = false;
                        pnlSTTaxation.Visible = false;
                        pnlCEManual.Visible = false;
                        pnlITActsGift.Visible = false;
                        pnlITActsInterest.Visible = false;
                        dltariff.Visible = false;
                        dlnontariff.Visible = false;
                        dlsafeguards.Visible = false;
                        dlCECothers.Visible = false;
                        dlSTN.Visible = false;
                        dlantidumpingduty.Visible = false;
                        pnlSION.Visible = false;
                        IncomeTaxCircularsNotification_SelectAllTableAdapter getITDetails = new IncomeTaxCircularsNotification_SelectAllTableAdapter();
                        DataTable dtGetITDetails = getITDetails.GetIndex(subcategory);
                        if (dtGetITDetails.Rows.Count > 0)
                        {
                            dtGetITDetails.Columns.Add("IsDoc");
                            foreach (DataRow dr in dtGetITDetails.Rows)
                            {
                                dr["IsDoc"] = dr["Data"] == null || dr["Data"].ToString() == string.Empty;
                            }
                            dlITActs.DataSource = dtGetITDetails;
                            dlITActs.DataBind();
                        }
                    }
                    #endregion
                }
                if (category == "DGFT" && subcategory == "FTDR Notifications")
                {
                    #region DGFFTDR

                    InvisibleRuleLabels();
                    InvisibleFormLabels();
                    //invisible all
                    dlIndex.Visible = false;
                    //invisible rules
                    dlAgreements.Visible = false;
                    dlBaggage.Visible = false;
                    dlCustomDrawBack.Visible = false;
                    dlCustomValuation.Visible = false;
                    dlOthers.Visible = false;
                    //invisible forms
                    dlRefunds.Visible = false;
                    dlAppeals.Visible = false;
                    dlDrawback.Visible = false;
                    dlOthersApplicationForms.Visible = false;
                    dlShipping.Visible = false;
                    dllBill.Visible = false;
                    dlBonds.Visible = false;
                    dlSettlementCommission.Visible = false;
                    dlSTCaseLaws.Visible = false;
                    //visible SEZ
                    gvSEZ.Visible = false;
                    //invisible ServiceTax Data
                    gvservicetaxforms.Visible = false;
                    gvstacts.Visible = false;
                    gvstrules.Visible = false;
                    dtstaccodes.Visible = false;
                    //invisible Circular/Instruction Headings
                    lblCircularHeading.Visible = false;
                    lblInstructionHeading.Visible = false;
                    pnlSTlibraries.Visible = false;
                    pnlSTTaxation.Visible = false;
                    pnlCEManual.Visible = false;
                    dlDGFT.Visible = true;
                    dlITActs.Visible = false;
                    pnlITActsGift.Visible = false;
                    pnlITActsInterest.Visible = false;
                    dlantidumpingduty.Visible = false;
                    pnlSION.Visible = false;

                    dltariff.Visible = false;
                    dlnontariff.Visible = false;
                    dlsafeguards.Visible = false;
                    dlCECothers.Visible = false;
                    dlSTN.Visible = false;
                    DGFT_FTDR_Notifications_GetAllTableAdapter indexBySubCategeory = new DGFT_FTDR_Notifications_GetAllTableAdapter();
                    DataTable dtDGFTFTDR = indexBySubCategeory.DGFT_FTDRNotification_Index(subcategory);
                    dlDGFT.DataSource = dtDGFTFTDR;
                    dlDGFT.DataBind();

                    #endregion

                } if (category == "DGFT" && subcategory == "FTP")
                {
                    #region DGFFTP

                    InvisibleRuleLabels();
                    InvisibleFormLabels();
                    //invisible all
                    dlIndex.Visible = false;
                    //invisible rules
                    dlAgreements.Visible = false;
                    dlBaggage.Visible = false;
                    dlCustomDrawBack.Visible = false;
                    dlCustomValuation.Visible = false;
                    dlOthers.Visible = false;
                    //invisible forms
                    dlRefunds.Visible = false;
                    dlAppeals.Visible = false;
                    dlDrawback.Visible = false;
                    dlOthersApplicationForms.Visible = false;
                    dlShipping.Visible = false;
                    dllBill.Visible = false;
                    dlBonds.Visible = false;
                    dlSettlementCommission.Visible = false;
                    dlSTCaseLaws.Visible = false;
                    //visible SEZ
                    gvSEZ.Visible = false;
                    //invisible ServiceTax Data
                    gvservicetaxforms.Visible = false;
                    gvstacts.Visible = false;
                    gvstrules.Visible = false;
                    dtstaccodes.Visible = false;
                    //invisible Circular/Instruction Headings
                    lblCircularHeading.Visible = false;
                    lblInstructionHeading.Visible = false; dlantidumpingduty.Visible = false;
                    pnlSTlibraries.Visible = false;
                    pnlSTTaxation.Visible = false;
                    pnlCEManual.Visible = false;
                    dlDGFT.Visible = true;
                    dlITActs.Visible = false;
                    pnlITActsGift.Visible = false;
                    pnlITActsInterest.Visible = false;
                    pnlSION.Visible = false;

                    dltariff.Visible = false;
                    dlnontariff.Visible = false;
                    dlsafeguards.Visible = false;
                    dlCECothers.Visible = false;
                    dlSTN.Visible = false;
                    DGFT_GetAllTableAdapter indexBySubCategeory = new DGFT_GetAllTableAdapter();
                    DataTable dtDGFTFTP = indexBySubCategeory.DGFT_FTP_Inde_select(subcategory);
                    dlDGFT.DataSource = dtDGFTFTP;
                    dlDGFT.DataBind();

                    #endregion
                }

                if (category == "DGFT" && subcategory == "public notices")
                {
                    #region DGFTpublicnotices

                    InvisibleRuleLabels();
                    InvisibleFormLabels();
                    //invisible all
                    dlIndex.Visible = false;
                    //invisible rules
                    dlAgreements.Visible = false;
                    dlBaggage.Visible = false;
                    dlCustomDrawBack.Visible = false;
                    dlCustomValuation.Visible = false;
                    dlOthers.Visible = false;
                    //invisible forms
                    dlRefunds.Visible = false;
                    dlAppeals.Visible = false;
                    dlDrawback.Visible = false;
                    dlOthersApplicationForms.Visible = false;
                    dlShipping.Visible = false;
                    dllBill.Visible = false;
                    dlBonds.Visible = false;
                    dlSettlementCommission.Visible = false;
                    dlSTCaseLaws.Visible = false;
                    //visible SEZ
                    gvSEZ.Visible = false;
                    //invisible ServiceTax Data
                    gvservicetaxforms.Visible = false;
                    gvstacts.Visible = false;
                    gvstrules.Visible = false;
                    dtstaccodes.Visible = false;
                    //invisible Circular/Instruction Headings
                    lblCircularHeading.Visible = false;
                    lblInstructionHeading.Visible = false;
                    pnlSTlibraries.Visible = false;
                    pnlSTTaxation.Visible = false;
                    pnlCEManual.Visible = false;
                    dlDGFT.Visible = true;
                    dlITActs.Visible = false;
                    pnlITActsGift.Visible = false; dlantidumpingduty.Visible = false;
                    pnlITActsInterest.Visible = false;
                    pnlSION.Visible = false;
                    dltariff.Visible = false;
                    dlnontariff.Visible = false;
                    dlsafeguards.Visible = false;
                    dlCECothers.Visible = false;
                    dlSTN.Visible = false;

                    DGFT_GetAllTableAdapter indexBySubCategeory = new DGFT_GetAllTableAdapter();
                    DataTable dtDGFTpublicnotice = indexBySubCategeory.DGFT_publicnotices_Index_select();
                    dlDGFT.DataSource = dtDGFTpublicnotice;
                    dlDGFT.DataBind();
                    #endregion

                }
                if (category == "DGFT" && subcategory == "SION")
                {
                    #region DGFTSION

                    pnlSION.Visible = true;

                    InvisibleRuleLabels();
                    InvisibleFormLabels();
                    //invisible all
                    dlIndex.Visible = false;
                    //invisible rules
                    dlAgreements.Visible = false;
                    dlBaggage.Visible = false;
                    dlCustomDrawBack.Visible = false;
                    dlCustomValuation.Visible = false;
                    dlOthers.Visible = false;
                    //invisible forms
                    dlRefunds.Visible = false;
                    dlAppeals.Visible = false;
                    dlDrawback.Visible = false;
                    dlOthersApplicationForms.Visible = false;
                    dlShipping.Visible = false;
                    dllBill.Visible = false;
                    dlBonds.Visible = false;
                    dlSettlementCommission.Visible = false;
                    dlSTCaseLaws.Visible = false;
                    //visible SEZ
                    gvSEZ.Visible = false;
                    //invisible ServiceTax Data
                    gvservicetaxforms.Visible = false;
                    gvstacts.Visible = false;
                    gvstrules.Visible = false;
                    dtstaccodes.Visible = false;
                    //invisible Circular/Instruction Headings
                    lblCircularHeading.Visible = false;
                    lblInstructionHeading.Visible = false; dlantidumpingduty.Visible = false;
                    pnlSTlibraries.Visible = false;
                    pnlSTTaxation.Visible = false;
                    pnlCEManual.Visible = false;
                    dlDGFT.Visible = false;
                    dlITActs.Visible = false;
                    pnlITActsGift.Visible = false;
                    pnlITActsInterest.Visible = false;

                    dltariff.Visible = false;
                    dlnontariff.Visible = false;
                    dlsafeguards.Visible = false;
                    dlCECothers.Visible = false;
                    dlSTN.Visible = false;

                    #endregion
                }

            }
        }
 protected void dlSTN_ItemCommand(object source, DataListCommandEventArgs e)
 {
     if (e.CommandName == "STN")
     {
         LinkButton linkButton = e.CommandSource as LinkButton;
         string _year2 = linkButton.Text;
         STN_GetAllTableAdapter stnInfo = new STN_GetAllTableAdapter();
         DataTable dtstnInfo = stnInfo.STN_InfoByYear(_year2, subcategory);
         if (dtstnInfo.Rows.Count > 0)
         {
             Response.Redirect("displayindex.aspx?cat=" + category + "&subcat=" + subcategory + "&year=" + _year2);
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            string category = Convert.ToString(Request.QueryString["cat"]);

            if (category == "Central")
            {
                category = "Central Excise";
                 subcategeory = "Case Laws";
            }

            else if (category == "Service")
            {
                category = "Service Tax";
                 subcategeory = "Case Laws";
            }

            else
            {
                 subcategeory = Request.QueryString["subcat"];
            }

            string indexName = Request.QueryString["name"];
            string chapter = Request.QueryString["chaptername"];
            string citation = Request.QueryString["citation"];
            cNumber = Convert.ToString(Request.QueryString["cnums"]);
            fNumber = Convert.ToString(Request.QueryString["fnums"]);
            year = Convert.ToString(Request.QueryString["years"]);
            string notification = Request.QueryString["notificationname"];
            string notificationnum = Convert.ToString(Request.QueryString["CECNnum"]);
            string STNnotificationnum = Convert.ToString(Request.QueryString["STNnum"]);

            #region Circulars/Instructions
            if (subcategeory == "Circulars/Instructions")
            {
                if (cNumber != "")
                {
                    Instructions_Data_ByCnumberTableAdapter getDatByCnumber = new Instructions_Data_ByCnumberTableAdapter();
                    DataTable dtDatByCnumber = getDatByCnumber.GetDatabyCnumber(cNumber, category, year);

                    if (dtDatByCnumber.Rows.Count > 0)
                    {
                        ltl.Text = Convert.ToString(dtDatByCnumber.Rows[0]["Data"]);

                    }
                }
                if (fNumber != "")
                {

                    Instructions1_Data_ByCnumberTableAdapter getDataByFnumber = new Instructions1_Data_ByCnumberTableAdapter();
                    DataTable dtDataByFnumber = getDataByFnumber.InstructionsData(fNumber, category, year);

                    if (dtDataByFnumber.Rows.Count > 0)
                    {
                        ltl.Text = Convert.ToString(dtDataByFnumber.Rows[0]["Data"]);

                    }
                }
            }
            #endregion

            #region Customs Tariff

            else if (category == "Customs" && subcategeory == "Tariff 2012-13")
            {
                if (indexName == null && chapter != "")
                {
                    Custom_Tariff_DataByChapteNameTableAdapter getDataByChapteName = new Custom_Tariff_DataByChapteNameTableAdapter();
                    DataTable dtDataByChapteName = getDataByChapteName.GetCTDataByChapterName(chapter);

                    if (dtDataByChapteName.Rows.Count > 0)
                    {

                        string tchaptername = Convert.ToString(dtDataByChapteName.Rows[0]["ChapterName"].ToString());
                        if (tchaptername != "")
                        {
                            string tdata = Convert.ToString(dtDataByChapteName.Rows[0]["Data"].ToString());
                            if (tdata != "")
                            {
                                ltl.Text = Convert.ToString(dtDataByChapteName.Rows[0]["Data"]);
                            }
                            else
                            {
                                byte[] b = ((byte[])dtDataByChapteName.Rows[0]["Document"]);
                                //Collect Bytes from database and write in Webpage
                                Response.ContentType = "application/pdf";
                                Response.BinaryWrite(b);
                                Response.Write("<script>window.open('Page.html','_blank')</script>");
                            }
                        }
                    }

                }

                else
                {

                    Custom_Tariff_DataByIndexNameTableAdapter getDataByIndexName = new Custom_Tariff_DataByIndexNameTableAdapter();
                    DataTable dtDataByIndexName = getDataByIndexName.GetCTDataByIndexName(indexName);
                    string tdata = Convert.ToString(dtDataByIndexName.Rows[0]["Data"].ToString());
                    if (tdata != "")
                    {
                        ltl.Text = Convert.ToString(dtDataByIndexName.Rows[0]["Data"]);

                    }
                    else
                    {

                        byte[] b = ((byte[])dtDataByIndexName.Rows[0]["Document"]);
                        //Collect Bytes from database and write in Webpage
                        Response.ContentType = "application/pdf";
                        Response.BinaryWrite(b);
                        Response.Write("<script>window.open('Page.html','_blank')</script>");

                    }
                }

            }
            #endregion

            #region Central Excise Tariff

            else if (category == "Central Excise" && subcategeory == "Tariff 2012-13")
            {
                if (indexName == null && chapter != "")
                {
                    CE_Tariff_DataByChapteNameTableAdapter getDataByChapteName = new CE_Tariff_DataByChapteNameTableAdapter();
                    DataTable dtDataByChapteName = getDataByChapteName.CE_Tariff_DataByChapter(chapter);
                    if (dtDataByChapteName.Rows.Count > 0)
                    {

                        string tchaptername = Convert.ToString(dtDataByChapteName.Rows[0]["ChapterName"].ToString());
                        if (tchaptername != "")
                        {
                            string tdata = Convert.ToString(dtDataByChapteName.Rows[0]["Data"].ToString());
                            if (tdata != "")
                            {
                                ltl.Text = Convert.ToString(dtDataByChapteName.Rows[0]["Data"]);
                            }
                            else
                            {
                                byte[] b = ((byte[])dtDataByChapteName.Rows[0]["Document"]);
                                //Collect Bytes from database and write in Webpage
                                Response.ContentType = "application/pdf";
                                Response.BinaryWrite(b);
                                Response.Write("<script>window.open('Page.html','_blank')</script>");
                            }
                        }
                    }

                }
                else
                {

                    CentralExcise_Tariff_GetAllTableAdapter getDataByIndexName = new CentralExcise_Tariff_GetAllTableAdapter();
                    DataTable dtDataByIndexName = getDataByIndexName.CE_Tariff_DataByIndex(indexName);
                    string tdata = Convert.ToString(dtDataByIndexName.Rows[0]["Data"].ToString());
                    if (tdata != "")
                    {
                        ltl.Text = Convert.ToString(dtDataByIndexName.Rows[0]["Data"]);

                    }
                    else
                    {

                        byte[] b = ((byte[])dtDataByIndexName.Rows[0]["Document"]);
                        //Collect Bytes from database and write in Webpage
                        Response.ContentType = "application/pdf";
                        Response.BinaryWrite(b);
                        Response.Write("<script>window.open('Page.html','_blank')</script>");

                    }
                }
            }
            #endregion

            #region Service Tax CaseLaws
            //else if (category == "Service Tax" && subcategeory == "Case Laws")
            //{
            //    STCaselaws_GetAllTableAdapter getSTCaselawsDataByindex = new STCaselaws_GetAllTableAdapter();
            //    DataTable dtSTCaselawsDataByindex = getSTCaselawsDataByindex.GetDataByIndexName(indexName);

            //    string stcl = Convert.ToString(dtSTCaselawsDataByindex.Rows[0]["Data"]);

            //    if (stcl != null)
            //    {
            //        ltl.Text = Convert.ToString(dtSTCaselawsDataByindex.Rows[0]["Data"]);
            //    }
            //    else
            //    {
            //        byte[] b = ((byte[])dtSTCaselawsDataByindex.Rows[0]["Document"]);
            //        //Collect Bytes from database and write in Webpage
            //        Response.ContentType = "application/pdf";
            //        Response.BinaryWrite(b);
            //        Response.Write("<script>window.open('Page.html','_blank')</script>");
            //    }

            //}
            #endregion

            #region STLibraries
            else if (category == "Library" && subcategeory == "Libraries")
            {
                string path = HttpContext.Current.Server.MapPath("faq-29sept11.pdf");
                System.Net.WebClient client = new System.Net.WebClient();
                Byte[] buffer = client.DownloadData(path);

                if (buffer != null)
                {
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("content-length", buffer.Length.ToString());
                    Response.TransmitFile(path);

                    //Response.BinaryWrite(buffer);
                }

            }
            #endregion

            #region STTaxation
            else if (category == "Service Tax" && subcategeory == "Taxation of Services: An Educational Guide")
            {
                string path = HttpContext.Current.Server.MapPath("st-edu-guide.pdf");
                System.Net.WebClient client = new System.Net.WebClient();
                Byte[] buffer = client.DownloadData(path);

                if (buffer != null)
                {
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("content-length", buffer.Length.ToString());
                    Response.TransmitFile(path);
                }

            }
            #endregion

            #region CEManual
            else if (category == "Service Tax" && subcategeory == "CBEC Manual")
            {
                string path = HttpContext.Current.Server.MapPath("cx-manual.pdf");
                System.Net.WebClient client = new System.Net.WebClient();
                Byte[] buffer = client.DownloadData(path);

                if (buffer != null)
                {
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("content-length", buffer.Length.ToString());
                    Response.TransmitFile(path);
                }

            }
            #endregion

            #region CECNotifications
            else if (subcategeory == "Notifications" & (category == "Customs" || category == "Central Excise"))
            {

                DataTable dtcectdata = null;
                CECNotification_GetAllTableAdapter cectdata = new CECNotification_GetAllTableAdapter();
                switch (notification)
                {
                    case "Tariff":

                        dtcectdata = cectdata.CEC_notificatondata_ByTnum(notificationnum, category, year);
                        break;
                    case "Non-Tariff":
                        dtcectdata = cectdata.CEC_notificatondata_ByNTnum(notificationnum, category, year);
                        break;
                    case "Safeguards":
                        dtcectdata = cectdata.CEC_notificatondata_BySnum(notificationnum, category, year);
                        break;
                    case "Anti Dumping Duty":
                        dtcectdata = cectdata.CEC_notificationdata_ByADDNum(notificationnum, category, year);
                        break;
                    case "Others":
                        dtcectdata = cectdata.CEC_notificationdata_ByOthersnum(notificationnum, category, year);
                        break;
                }

                string stcl = Convert.ToString(dtcectdata.Rows[0]["Data"]);

                if (stcl != null)
                {
                    ltl.Text = Convert.ToString(dtcectdata.Rows[0]["Data"]);
                }
                else
                {
                    byte[] b = ((byte[])dtcectdata.Rows[0]["Document"]);
                    //Collect Bytes from database and write in Webpage
                    Response.ContentType = "application/pdf";
                    Response.BinaryWrite(b);
                    Response.Write("<script>window.open('Page.html','_blank')</script>");
                }
            }
            #endregion

            #region  STNotifications

            else if (category == "Service Tax" && subcategeory == "Notifications")
            {
                STN_GetAllTableAdapter stnshow = new STN_GetAllTableAdapter();
                DataTable dtstnshow = stnshow.STN_DataByFnum(STNnotificationnum, subcategeory, year);
                string stcl = Convert.ToString(dtstnshow.Rows[0]["Data"]);

                if (stcl != null)
                {
                    ltl.Text = Convert.ToString(dtstnshow.Rows[0]["Data"]);
                }
                else
                {
                    byte[] b = ((byte[])dtstnshow.Rows[0]["Document"]);
                    //Collect Bytes from database and write in Webpage
                    Response.ContentType = "application/pdf";
                    Response.BinaryWrite(b);
                    Response.Write("<script>window.open('Page.html','_blank')</script>");
                }
            }

            #endregion

            #region DGFT
                        else if (category == "DGFT" & subcategeory == "public notices")
            {
                DGFTpublicnotices_GETALLTableAdapter DGFTNoticenum = new DGFTpublicnotices_GETALLTableAdapter();
               DataTable dtChapterName = DGFTNoticenum.DGFT_publicnoticdata(indexName, chapter);
               string stcl = Convert.ToString(dtChapterName.Rows[0]["Data"]);

               if (stcl != null)
               {
                   ltl.Text = Convert.ToString(dtChapterName.Rows[0]["Data"]);
               }
               else
               {
                   byte[] b = ((byte[])dtChapterName.Rows[0]["Document"]);
                   //Collect Bytes from database and write in Webpage
                   Response.ContentType = "application/pdf";
                   Response.BinaryWrite(b);
                   Response.Write("<script>window.open('Page.html','_blank')</script>");
               }
            }
            else if (category == "DGFT" & subcategeory == "FTDR Notifications")
            {
                DGFT_FTDR_Notifications_GetAllTableAdapter DGFTNoticenum = new DGFT_FTDR_Notifications_GetAllTableAdapter();
               DataTable dtChapterName = DGFTNoticenum.DGFT_FTDRnotic_Data(indexName, chapter);
               string stcl = Convert.ToString(dtChapterName.Rows[0]["Data"]);

               if (stcl != null)
               {
                   ltl.Text = Convert.ToString(dtChapterName.Rows[0]["Data"]);
               }
               else
               {
                   byte[] b = ((byte[])dtChapterName.Rows[0]["Document"]);
                   //Collect Bytes from database and write in Webpage
                   Response.ContentType = "application/pdf";
                   Response.BinaryWrite(b);
                   Response.Write("<script>window.open('Page.html','_blank')</script>");
               }

            }
            #endregion

            #region Library
             else if (category == "Library")
                {
                    Library_SelectAllTableAdapter LibraryData = new Library_SelectAllTableAdapter();
                    //Library_RSRules_SelectAllTableAdapter CEActsChapter = new Library_RSRules_SelectAllTableAdapter();
                   DataTable dtChapterName = LibraryData.Library_Data_Select(subcategeory, indexName);

                    string stcl = Convert.ToString(dtChapterName.Rows[0]["Data"]);

                    if (stcl != null & stcl !="")
                    {
                        ltl.Text = Convert.ToString(dtChapterName.Rows[0]["Data"]);
                    }
                    else
                    {
                        byte[] b = ((byte[])dtChapterName.Rows[0]["Document"]);
                        //Collect Bytes from database and write in Webpage
                        Response.ContentType = "application/pdf";
                        Response.BinaryWrite(b);
                        Response.Write("<script>window.open('Page.html','_blank')</script>");
                    }

                }
            #endregion

            #region Caselaws
            else if (subcategeory == "Case Laws" || subcategeory == "Case")
              {
                  GetAllCaseLawsTableAdapter getdatabycitation = new GetAllCaseLawsTableAdapter();
                  DataTable dtgetdatabycitation = getdatabycitation.GetDataByCitation(category, citation);

                  if (dtgetdatabycitation.Rows.Count > 0)
                  {
                      string strCourt = "";
                      if (dtgetdatabycitation.Rows[0]["Court"].ToString().Contains("CESTAT"))
                      {
                          strCourt="CUSTOMS, EXCISE AND SERVICE TAX APPELLATE TRIBUNAL<br/>"+dtgetdatabycitation.Rows[0]["Bench"];
                      }
                      else
                      {
                          strCourt=dtgetdatabycitation.Rows[0]["Court"]+" "+dtgetdatabycitation.Rows[0]["Bench"];
                      }

                      LtlCaselaws.Text += "<table class='citCase' width='100%'  align='center'><tr><th width='100%' align='center'>" + citation.ToUpper() + "</th></tr><tr>";
                      LtlCaselaws.Text += "<td width='100%' align='center'>" + strCourt.ToUpper() + "</td></tr><tr>";
                      LtlCaselaws.Text += "<td align='center'>" + dtgetdatabycitation.Rows[0]["CaseNumber"] + "</td></tr><tr>";
                      LtlCaselaws.Text += "<td align='center' class='parties'>";
                      LtlCaselaws.Text += dtgetdatabycitation.Rows[0]["APPELLANTParty"].ToString().ToUpper() + "<br/>Vs.<br/>";
                      LtlCaselaws.Text += dtgetdatabycitation.Rows[0]["RESPONDENTParty"].ToString().ToUpper() + "</td></tr><tr><td  align='left'>";
                      LtlCaselaws.Text += dtgetdatabycitation.Rows[0]["JudgesName"] + "</td></tr><tr><td  align='right'>";
                      LtlCaselaws.Text +="Dated:&nbsp;" +((DateTime)dtgetdatabycitation.Rows[0]["DateofDecision"]).ToString("MMMM dd, yyyy") + "</td></tr><tr><td style='text-align:left' align='justify'>";
                      LtlCaselaws.Text += dtgetdatabycitation.Rows[0]["HeadNotes"] + "</td></tr><tr><td>&nbsp;</td></tr><tr><td></td></tr>";

                      LtlCaselaws.Text += "<tr><td style='font-weight:normal' align='justify'>";

                      LtlCaselaws.Text += dtgetdatabycitation.Rows[0]["JUDGEMENTContent"] + "</td></tr>";
                      LtlCaselaws.Text += "<tr><td style='padding:45px;font-style:italic;font-weight:normal;text-align:left' align='justify'><font face='Verdana, Arial, Helvetica, sans-serif' color='#666666' size='1'>(<b style='font-weight:bold'>DISCLAIMER</b>: Though all efforts have been made to reproduce the order correctly but the access and circulation is subject to the condition that TaxgenieOnline are not responsible/liable for any loss or damage caused to anyone due to any mistake/error/omissions.)</font></td></tr>";
                      LtlCaselaws.Text += "</table>";
                  }
               }

            #endregion

            else
            {
                DataTable dtChapterName = new DataTable();

                if (category == "Customs")
                {
                    ActsTableAdapter chapterName = new ActsTableAdapter();
                    dtChapterName = chapterName.Data_Select(subcategeory, indexName);
                }
                else if (category == "Central Excise")
                {
                    CEActsTableAdapter CEActsChapter = new CEActsTableAdapter();
                    dtChapterName = CEActsChapter.CEData(subcategeory, indexName);
                }
                else if (category == "Service Tax")
                {
                    ServiceTax_GetAll1TableAdapter STchaptername = new ServiceTax_GetAll1TableAdapter();
                    dtChapterName = STchaptername.GetSTData(subcategeory, indexName);
                }

                else if (category == "DGFT" & subcategeory == "FTP")
                {
                    DGFT_GetAllTableAdapter FTPchapterName = new DGFT_GetAllTableAdapter();
                    dtChapterName = FTPchapterName.DGFT_FTP_Data_select(subcategeory, indexName);
                }

                else if (category == "Income Tax" & (subcategeory == "Income Tax Act" || subcategeory == "Wealth Tax Act" || subcategeory == "Expenditure Tax Act" || subcategeory == "Finance Act"))
                {
                    IncomeTaxActs_SelectAllTableAdapter itActsData = new IncomeTaxActs_SelectAllTableAdapter();
                    dtChapterName = itActsData.GetDataByIndex(subcategeory, indexName);
                }

                else if (category == "Income Tax" & (subcategeory == "Income Tax Rules" || subcategeory == "Other Direct Tax Rules"))
                {
                    IncomeTaxRules_SelectAllTableAdapter itActsData = new IncomeTaxRules_SelectAllTableAdapter();
                    dtChapterName = itActsData.GetDataByIndex(subcategeory, indexName);
                }

                else if (category == "Income Tax" & (subcategeory == "Circulars" || subcategeory == "Notifications"))
                {
                    IncomeTaxCircularsNotification_SelectAllTableAdapter itActsData = new IncomeTaxCircularsNotification_SelectAllTableAdapter();
                    dtChapterName = itActsData.GetDataByIndex(subcategeory, indexName);
                }

                if (dtChapterName.Rows.Count > 0)
                {
                    string aChapterName = Convert.ToString(dtChapterName.Rows[0]["ChapterName"].ToString());
                    string aSections = Convert.ToString(dtChapterName.Rows[0]["Sections"].ToString());
                    string adata = Convert.ToString(dtChapterName.Rows[0]["Data"].ToString());
                    string aDocumenet = Convert.ToString(dtChapterName.Rows[0]["Document"].ToString());

                    if (aChapterName == "" & aSections == "" & aDocumenet == "")
                    {
                        ltl.Text = Convert.ToString(dtChapterName.Rows[0]["Data"]);
                    }
                    else if (aChapterName == "" & aSections == "" & adata == "")
                    {
                        byte[] b = ((byte[])dtChapterName.Rows[0]["Document"]);
                        //Collect Bytes from database and write in Webpage
                        Response.ContentType = "application/pdf";
                        Response.BinaryWrite(b);
                    }
                    else
                    {
                        // ltl.Text = "<table><tr><td style='width=500px'>";
                        foreach (DataRow drChapterName in dtChapterName.Rows)
                        {
                            string aChapter = drChapterName["ChapterName"].ToString().Trim();
                            if (chapter.Trim().Equals(aChapter))
                            {
                                ltl.Text = Convert.ToString(drChapterName["Data"]);
                            }
                        }
                    }
                }
            }
        }
        protected void STNotifications()
        {
            STN_GetAllTableAdapter stnadp = new STN_GetAllTableAdapter();
            DataTable dtstn = new DataTable();
            dtstn = stnadp.STN_InfoByYear(year, subcategory);

            if(dtstn.Rows.Count>0)
            {
                gvSTNotification.DataSource = dtstn;
                gvSTNotification.DataBind();
            }
        }