|
报错:
值不能为 null。
参数名: relativeUrl
调试均无错误
protected void Page_Init(object sender, EventArgs e)
{
InitMenu();
}
private void InitMenu()
{
IList<menu> menus = new List<menu>();
menus = MenuService.GetMenuTree();
ExtAspNet.Tree tree = new ExtAspNet.Tree();
Region2.Items.Add(tree);
tree.ShowBorder = false;
tree.ShowHeader = false;
tree.AutoScroll = true;
tree.EnableArrows = true;
ResolveMenuTree(menus, 0, tree.Nodes);
}
/// <summary> /// 生成菜单树 /// </summary>
/// <param name="menus"></param>
/// <param name="parentMenuId"></param>
/// <param name="nodes"></param>
/// <returns>当前节点的子节点个数</returns>
///
private int ResolveMenuTree(IList<menu> menus, int parentMenuId, ExtAspNet.TreeNodeCollection nodes)
{
int count = 0;
foreach (menu menu in menus)
{
if (menu.pk_parentmenu == parentMenuId)
{
ExtAspNet.TreeNode node = new ExtAspNet.TreeNode();
nodes.Add(node);
node.Text = menu.menuname;
node.IconUrl = menu.imageurl;
if (!String.IsNullOrEmpty(menu.navifateurl))
{
node.NavigateUrl = menu.navifateurl;
node.Target = "main";
}
int childCount = ResolveMenuTree(menus, menu.pk_menu, node.Nodes);
if (childCount == 0)
{
node.Leaf = true;
}
count++;
}
}
return count;
}
堆栈跟踪:
[ArgumentNullException: 值不能为 null。参数名: relativeUrl] System.Web.UI.Control.ResolveUrl(String relativeUrl) +2813231 ExtAspNet.IconHelper.GetResolvedIconUrl(Icon icon, String iconUrl) +91 ExtAspNet.ControlBase.GetResolvedIconUrl(Icon icon, String iconUrl) +35 ExtAspNet.Tree.GetNodesJSONArray(TreeNodeCollection nodes) +741 ExtAspNet.Tree.get_X_Nodes() +25[TargetInvocationException: 调用的目标发生了异常。] System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0 System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28 System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +63 System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) +19 ExtAspNet.ControlBase.GetPropertyJSONValue(String prop) +77 ExtAspNet.XState.CalculateModifiedProperties() +147 ExtAspNet.ControlBase.OnPreRender(EventArgs e) +106 System.Web.UI.Control.PreRenderRecursiveInternal() +103 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496 |
|
|