如何在服务器端处理 treepanel 单击的节点详细信息(id、文本、标签或作为 Ext.Net.Node 对象)?

How to handle treepanel clicked node details(id,text,tag,or as Ext.Net.Node object) at server-side?

我试过下面的代码。

我正在使用那个版本 https://www.nuget.org/packages/Ext.NET.MVC/3.2.0

TreePanel treePanel = new TreePanel();
treePanel.ID = "TreePanel1";
treePanel.RootVisible = false;
treePanel.DirectEvents.ItemClick.Url = "/Menu/TreePanelClickHandler";
treePanel.DirectEvents.ItemClick.Method = HttpMethod.POST;
treePanel.DirectEvents.ItemClick.ExtraParams.Add(new Parameter("param1", "value1", ParameterMode.Value));
treePanel.DirectEvents.ItemClick.ExtraParams.Add(new Parameter("param2", "value2", ParameterMode.Value));

控制器

public class MenuController : Controller
{
   public ActionResult TreePanelClickHandler(string param1,string param2)
   {
      X.Msg.Alert("server-side:", param1 + "\n" + param2).Show();
      AjaxResult r = new AjaxResult();
      return r;
   }
}

Forum Topic

有什么想法吗?

TreePanel treePanel = new TreePanel();
treePanel.ID = "TreePanel1";
treePanel.Border = false;
treePanel.RootVisible = false;

treePanel.DirectEvents.ItemClick.Before = "o.extraParams.param1 = record.data.id; o.extraParams.param2 = record.data.text; o.extraParams.param3 = record.raw['tag'];";
treePanel.DirectEvents.ItemClick.Url = "/Menu/ClickMeHandler";
treePanel.DirectEvents.ItemClick.Method = HttpMethod.POST;

当 Ext.Net.Node 创建时

subNode.CustomAttributes.Add(new ConfigItem("tag", "testdata"));

控制器

public class MenuController : Controller
{
   public ActionResult TreePanelClickHandler(string param1,string param2,string param3)
   {
      X.Msg.Alert("server-side:", param1 + "\n" + param2+ "\n" + param3).Show();
      AjaxResult r = new AjaxResult();
      return r;
   }
}