using framework_business; using framework_library; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class controls_module_faq : System.Web.UI.UserControl { #region methods private string BuildFAQ(string question, string answer, int sequence) { StringBuilder faq = new StringBuilder(); faq.Append("
"); faq.Append("
"); faq.Append("

" + question); faq.Append(""); else faq.Append("href=\"#collapse" + sequence + "\" aria-expanded=\"false\" aria-controls=\"collapse" + sequence + "\">"); faq.Append(""); faq.Append("

"); if (sequence == 1) faq.Append("
"); else faq.Append("
"); faq.Append("
"); faq.Append(answer); faq.Append("
"); return faq.ToString(); } private void BindQuestions() { try { int seq = 0; StringBuilder html = new StringBuilder(); foreach (oFAQ faq in xData.GetTypedByCriteriaSpecific("recId", typeof(oFAQ), "isActive", "1")) { seq++; html.Append(BuildFAQ(faq.question, faq.answer, seq)); } accordion.InnerHtml = html.ToString(); } catch (Exception ex) { exception.HandleException("faq:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]); Response.Redirect("/error", false); } } private void BindFooter() { try { string footer = ""; foreach (oTemplate template in xData.GetTypedByCriteriaSpecific("recId", typeof(oTemplate), "templateTypeId", pNums.TemplateType.Content.GetHashCode().ToString())) { if (template.templateName.ToLower().Contains("faq")) { footer = template.templateContent; break; } } divFooter.InnerHtml = footer; } catch (Exception ex) { exception.HandleException("faq:", MethodBase.GetCurrentMethod().Name, ex, Session["admin"]); //no exception } } #endregion #region events protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindQuestions(); /* CVH 2016-09-05 TSP Merge. Show footer loaded from Content Template "FAQ" */ BindFooter(); } } #endregion }