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);
             }
         }
     }
 }