@@ -9,23 +7,9 @@
-
-
-
diff --git a/FAQs.ascx.cs b/FAQs.ascx.cs
index a92bc85..b902651 100644
--- a/FAQs.ascx.cs
+++ b/FAQs.ascx.cs
@@ -30,8 +30,6 @@
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Localization;
-using Telerik.Web.UI;
-using DotNetNuke.Web.UI.WebControls;
namespace DotNetNuke.Modules.FAQs
{
@@ -304,6 +302,23 @@ public int RequestFaqId
#region Private Methods
+ private void PopulateTreeView(List list, int ParentId, TreeNodeCollection treeNode)
+ {
+ foreach (var row in list.Where(x => x.FaqCategoryParentId == ParentId))
+ {
+ TreeNode child = new TreeNode
+ {
+ Text = row.FaqCategoryName,
+ Value = row.FaqCategoryId.ToString()
+ };
+
+ treeNode.Add(child);
+ var dtChild = list.Where(x => x.FaqCategoryParentId == ParentId).ToList();
+ if (dtChild.Count > 0)
+ PopulateTreeView(list, row.FaqCategoryId, child.ChildNodes);
+ }
+ }
+
///
/// Binds the (filtered) faq data.
///
@@ -401,18 +416,6 @@ private void BindCategories()
switch (ShowCategoryType)
{
case 0:
- if (noCat)
- categories.Add(emptyCategory);
- foreach (CategoryInfo cat in cats)
- {
- categories.Add(cat);
- }
- listCategories.DataSource = categories;
- listCategories.DataBind();
- mvShowCategoryType.SetActiveView(vShowCategoryTypeList);
- pnlShowCategoryTypeDropdown.Visible = false;
- break;
-
case 1:
categories.Add(allCategories);
if (noCat)
@@ -424,18 +427,14 @@ private void BindCategories()
// treeCategories fails with int? FaqCategoryParentId
// define a temp class that has no nullables
// set null ints to Null.NullInt
- ArrayList lst = new ArrayList();
+ var lst = new List();
foreach (CategoryInfo cat in categories)
{
lst.Add(cat.ToTreeNode());
}
- treeCategories.DataTextField = "FaqCategoryName";
- treeCategories.DataFieldID = "FaqCategoryId";
- treeCategories.DataFieldParentID = "FaqCategoryParentId";
- treeCategories.DataSource = lst;
- treeCategories.DataBind();
- if (!IsPostBack)
- treeCategories.Nodes[0].Selected = true;
+
+ PopulateTreeView(lst, 0, treeCategories.Nodes);
+
mvShowCategoryType.SetActiveView(vShowCategoryTypeTree);
pnlShowCategoryTypeDropdown.Visible = false;
break;
@@ -482,36 +481,6 @@ private bool MatchElement(FAQsInfo fData)
switch (ShowCategoryType)
{
case 0:
- //Filter on the checked items
- foreach (RadListBoxItem item in listCategories.Items)
- {
-
- //Get the checkbox in the Control
- CheckBox chkCategory = (CheckBox)(item.FindControl("chkCategory"));
-
- //If checked the faq module is being filtered on one or more category's
- if (chkCategory.Checked)
- {
-
- //Set Checked Flag
- noneChecked = false;
-
- //Get the filtered category
- string checkedCategoryName = chkCategory.Text;
-
- //Get the elements that match the catagory
- var matchedCat = (from c in cats where c.FaqCategoryId == fData.CategoryId select c).SingleOrDefault();
- categoryName = (matchedCat != null ? matchedCat.FaqCategoryName : "");
-
- if ((categoryName == checkedCategoryName) ||
- (fData.CategoryId == null && checkedCategoryName == Localization.GetString("EmptyCategory", LocalResourceFile)))
- {
- match = true;
- break;
- }
- }
- }
- break;
case 1:
if (treeCategories.SelectedNode != null)
{
@@ -816,39 +785,6 @@ protected void chkCategory_CheckedChanged(object sender, EventArgs e)
BindData();
}
- ///
- /// Handles the ItemDataBound event of the listCategories control (adds Tooltip)
- ///
- /// The source of the event.
- /// instance containing the event data.
- protected void listCategories_ItemDataBound(object sender, RadListBoxItemEventArgs e)
- {
- if (ShowToolTips)
- e.Item.ToolTip = (string)DataBinder.Eval(e.Item.DataItem, "FaqCategoryDescription");
- }
-
- ///
- /// Handles the NodeClick event of the treeCategories control (rebinds data)
- ///
- /// The source of the event.
- /// instance containing the event data.
- protected void treeCategories_NodeClick(object sender, EventArgs e)
- {
- //Rebind Data
- BindData();
- }
-
- ///
- /// Handles the NodeDataBound event of the treeCategories control (adds Tooltip)
- ///
- /// The source of the event.
- /// instance containing the event data.
- protected void treeCategories_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
- {
- if (ShowToolTips)
- e.Node.ToolTip = (string)DataBinder.Eval(e.Node.DataItem, "FaqCategoryDescription");
- }
-
protected void drpCategories_SelectedIndexChanged(object sender, EventArgs e)
{
//Rebind Data
@@ -865,6 +801,10 @@ protected void drpSort_SelectedIndexChanged(object sender, EventArgs e)
#endregion
+ protected void treeCategories_SelectedNodeChanged(object sender, EventArgs e)
+ {
+ BindData();
+ }
}
}
diff --git a/FAQs.ascx.designer.cs b/FAQs.ascx.designer.cs
index 162a664..e63bd91 100644
--- a/FAQs.ascx.designer.cs
+++ b/FAQs.ascx.designer.cs
@@ -7,11 +7,13 @@
//
//------------------------------------------------------------------------------
-namespace DotNetNuke.Modules.FAQs {
-
-
- public partial class FAQs {
-
+namespace DotNetNuke.Modules.FAQs
+{
+
+
+ public partial class FAQs
+ {
+
///
/// pnlShowCategories control.
///
@@ -20,7 +22,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.Panel pnlShowCategories;
-
+
///
/// mvShowCategoryType control.
///
@@ -29,25 +31,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.MultiView mvShowCategoryType;
-
- ///
- /// vShowCategoryTypeList control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.View vShowCategoryTypeList;
-
- ///
- /// listCategories control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::DotNetNuke.Web.UI.WebControls.DnnListBox listCategories;
-
+
///
/// vShowCategoryTypeTree control.
///
@@ -56,7 +40,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.View vShowCategoryTypeTree;
-
+
///
/// treeCategories control.
///
@@ -64,8 +48,8 @@ public partial class FAQs {
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
///
- protected global::DotNetNuke.Web.UI.WebControls.DnnTreeView treeCategories;
-
+ protected global::System.Web.UI.WebControls.TreeView treeCategories;
+
///
/// pnlSortbox control.
///
@@ -74,7 +58,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.Panel pnlSortbox;
-
+
///
/// lblSort control.
///
@@ -83,7 +67,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.UserControl lblSort;
-
+
///
/// drpSort control.
///
@@ -92,7 +76,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.DropDownList drpSort;
-
+
///
/// pnlShowCategoryTypeDropdown control.
///
@@ -101,7 +85,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.Panel pnlShowCategoryTypeDropdown;
-
+
///
/// lblSelectCategory control.
///
@@ -110,7 +94,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.UserControl lblSelectCategory;
-
+
///
/// drpCategories control.
///
@@ -119,7 +103,7 @@ public partial class FAQs {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.DropDownList drpCategories;
-
+
///
/// lstFAQs control.
///
diff --git a/FAQsCategories.ascx b/FAQsCategories.ascx
index ee511b4..a219636 100644
--- a/FAQsCategories.ascx
+++ b/FAQsCategories.ascx
@@ -1,15 +1,9 @@
<%@ Control Language="C#" Inherits="DotNetNuke.Modules.FAQs.FAQsCategories" AutoEventWireup="true" CodeBehind="FAQsCategories.ascx.cs" %>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web" %>
-<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web.Deprecated" %>
-<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
|