private void CheckUrlParams() { string[] path = Request.Path.Split('/'); if (path.Length == 4) { string category = path[2].Replace("_", " "); string question = path[3].Replace("_", " "); faqView.SetActiveView(vQuestion); var faq = SnitzFaq.GetQuestion(String.Format("/{0}/{1}", category, question), "").ToList(); if (faq.Count() == 1 && faq[0] != null) { fvQuestion.Text = string.Format("<h1>{0}?</h1>", question); fvAnswer.Text = faq[0].LinkBody.ReplaceNoParseTags(); hdnFaqId.Value = faq[0].Id.ToString(); } btnDeleteFaq.OnClientClick = "confirmPostBack('Do you want to delete Question and answer?','Delete'," + hdnFaqId.Value + ");return false;"; btnEdit.Visible = IsAdministrator || Roles.IsUserInRole("FAQEditor"); btnDeleteFaq.Visible = IsAdministrator || Roles.IsUserInRole("FAQEditor"); } else { faqView.SetActiveView(vDefault); hdnFaqId.Value = "-1"; } }
protected void ToggleEdit(object sender, ImageClickEventArgs e) { faqView.SetActiveView(vEdit); string[] path = Request.Path.Split('/'); if (path.Length == 4) { string category = path[2].Replace("_", " "); string question = path[3].Replace("_", " "); var faq = SnitzFaq.GetQuestion(String.Format("/{0}/{1}", category, question), "").ToList(); if (faq.Count() == 1) { feCategory.SelectedValue = faq[0].CatId.ToString(); feTitle.Text = question; feOrder.Text = faq[0].Order.ToString(); feBody.Text = faq[0].LinkBody; hdnFaqId.Value = faq[0].Id.ToString(); } } }