Hey, this is intended toward all those developers out their regarding the DNN Navigation framework. I've only been disecting how DNN renders menus for a short time and am in dire need to direction.
This is what I have so far... it's very close to the solpart actions class. I wrote it almost convinced that it would work but the nodes that were rendered ended up being attributes in the parent SPAN of the DNN Menu.
What I am intending to do is just extract the action menu item nodes, nothing more, nothing fancy. Not even formatted for HTML, I am content with a collection. What I am intending to do with this is format the links (action menu) in a bullet list form, no drop down.
I'm not asking for a solution, but any guidance as to where to look is more than appreciated! Thanks, Phil
using DotNetNuke;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.UI;
using DotNetNuke.UI.Utilities;
using DotNetNuke.UI.WebControls;
using System;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace DotNetNuke.UI.Containers
{
public partial class myBusinessActions : UI.Containers.ActionBase
{
private Modules.NavigationProvider.NavigationProvider objControl;
private string strProviderName = "DNNMenuNavigationProvider";
private DNNNodeCollection objNodes;
private int objIntExpandDepth = -1;
private bool objBoolPopulateNodesFromClient = false;
#region Properites
public string ProviderName
{
get { return strProviderName; }
set { strProviderName = value; }
}
public Modules.NavigationProvider.NavigationProvider Control
{
get { return objControl; }
set { objControl = value; }
}
public int ExpandDepth
{
get { if (this.PopulateNodesFromClient = false) return -1; return objIntExpandDepth; }
set { objIntExpandDepth = value; }
}
public bool PopulateNodesFromClient
{
get { return objBoolPopulateNodesFromClient; }
set { objBoolPopulateNodesFromClient = value; }
}
#endregion
protected override void OnPreRender(EventArgs e)
{
//this.BindMenu(Navigation.GetActionNodes(this.ActionRoot, this, this.ExpandDepth));
}
protected override void OnLoad (EventArgs e)
{
objControl = Modules.NavigationProvider.NavigationProvider.Instance(this.ProviderName);
objNodes = Navigation.GetActionNodes(this.ActionRoot, this, Control.NavigationControl);
Control.Initialize();
Control.PopulateOnDemand += new Modules.NavigationProvider.NavigationProvider.PopulateOnDemandEventHandler(this.Control_PopulateOnDemand);
myParentDiv.Controls.Add(Control.NavigationControl);
}
private void Control_PopulateOnDemand (Modules.NavigationProvider.NavigationEventArgs args)
{
this.ActionRoot.Actions.AddRange(this.PortalModule.Actions);
Entities.Modules.Actions.ModuleAction objAction = this.ActionRoot;
if (this.ActionRoot.ID != Convert.ToInt32(args.ID))
objAction = this.GetAction(Convert.ToInt32(args.ID));
if (args.Node == null)
args.Node = Navigation.GetActionNode(args.ID, Control.ID, objAction, this);
this.Control.ClearNodes();
this.BindMenu(Navigation.GetActionNodes(objAction, args.Node, this, this.ExpandDepth));
}
private void BindMenu (DNNNodeCollection _objNodes)
{
this.Visible = DisplayControl(_objNodes);
if (this.Visible)
{
this.Control.ClearNodes();
foreach (DNNNode _objNode in _objNodes)
ProcessNodes(_objNode);
Control.Bind(_objNodes);
}
}
private void ProcessNodes (DNNNode _objParent)
{
if (_objParent.JSFunction.Length > 0)
ClientAPI.RegisterClientVariable(this.Page, objControl.NavigationControl.ClientID, _objParent.JSFunction, true);
foreach (DNNNode _objNode in _objParent.DNNNodes)
ProcessNodes(_objNode);
}
}
}