PDA

View Full Version : [CLOSED] NodeCollection Listener.Click.Handler changes



TuscanDev
Oct 31, 2012, 7:20 PM
The site builds, and comes up locally; however, clicking on any of the treeNodes will not open up the requested aspx page.

On other pages, I would change the old code:


node.Listeners.Click.Handler = handler;

with something like:


this.templateTree.Listeners.ItemClick.Handler = handler;

However, I can't use "this" in this section due to it being static.

this is the method in question, etc.



private static NodeCollection GetPages(MenuGroup mg, bool LoadUrl)
{
NodeCollection collection = new NodeCollection();
if (mg.MenuPages != null)
{
if (mg.MenuPages.Length > 0)
{
foreach (MenuPage mp in mg.MenuPages)
{
Node node = new Node();
node.Text = mp.MenuPageName;
node.Icon = Icon.Page;
node.NodeID = String.Format("{0},{1}", mg.MenuGroupId, mp.MenuPageId);
if (LoadUrl)
{
string handler = String.Format(
"Ext.net.DirectMethods.GetTabs('{0}','{1}','{2}')",
"tab" + mp.MenuPageId,
mp.MenuPageName,
string.Format("/Views/{0}.aspx", mp.MenuPageLocation));

//node.Listeners.Click.Handler = handler; //OLD CODE
}
node.Leaf = true;
collection.Add(node);
}
}
}
return collection;
}

not sure how to get to the Listener in the code behind here.

Daniil
Oct 31, 2012, 7:51 PM
Hi @TuscanDev,

Yes, there is no Click event in Node, because it is not an UI element anymore. So, no UI events.

A single solution is using an ItemClick event. A node is passed to its listener as an argument.

I would suggest you to set up a custom attribute for each node where you can put a link to. Then use this custom attribute within an ItemClick listener.