private void LoadCECircularsInstructions(GridView eGrid)
        {
            Circulars_Info_ByyearTableAdapter index = new Circulars_Info_ByyearTableAdapter();
            DataTable dtActsIndexName = index.GetCEcircularsByCat(ddlcatagory.SelectedValue);
            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[4].Visible = false;
                    editGrid.HeaderRow.Cells[5].Visible = false;
                    //editGrid.HeaderRow.Cells[6].Visible = false;
                    foreach (GridViewRow gvr in editGrid.Rows)
                    {
                        gvr.Cells[4].Visible = false;
                        gvr.Cells[5].Visible = false;
                        //gvr.Cells[6].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;
                            }
                        }

                    }
                }
            }
        }
 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);
             }
         }
     }
 }
        public void CircularsInstructions()
        {
            if (rdbUploadType.SelectedValue == "Upload the Document")
            {
                UploadPDF();
            }
            try
            {
                Circulars_InsertTableAdapter insertCirculars = new Circulars_InsertTableAdapter();
                Circulars_Info_ByyearTableAdapter updateCirculars = new Circulars_Info_ByyearTableAdapter();
                if (hdnId.Value.Length > 0)
                {
                    int? id = Int32.Parse(hdnId.Value);
                    if (bytes != null && bytes.Length > 1)
                    {
                        updateCirculars.UpdateCEcircularById(ddlcatagory.SelectedValue, rdbCircularUploadType.SelectedValue, txtCircularYear.Text, txtCircularNumber.Text, txtCircularDate.Text, txtCircularFileNumber.Text, txtCircularSubject.Text, edtData.Content, bytes, id);
                    }
                    else
                    {
                        updateCirculars.UpdateCEcircularByIdNoDoc(ddlcatagory.SelectedValue, rdbCircularUploadType.SelectedValue, txtCircularYear.Text, txtCircularNumber.Text, txtCircularDate.Text, txtCircularFileNumber.Text, txtCircularSubject.Text, edtData.Content, id);
                    }
                    Server.Transfer("editnotifications.aspx");
                }
                else
                {
                    insertCirculars.Circulars_Insert(ddlcatagory.SelectedValue, rdbCircularUploadType.SelectedValue, txtCircularYear.Text, txtCircularNumber.Text, txtCircularDate.Text, txtCircularFileNumber.Text, txtCircularSubject.Text, edtData.Content, bytes);
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
 protected void gvindexcircularvalues()
 {
     Circulars_Info_ByyearTableAdapter cirinfo = new Circulars_Info_ByyearTableAdapter();
     DataTable dtinfo = cirinfo.CircularsInfoByyear(year, category);
     if (dtinfo.Rows.Count > 0)
     {
         gvindexcircular.DataSource = dtinfo;
         gvindexcircular.DataBind();
     }
 }