如何使用子项中的子菜单名称进行删除 [英] How to use the sub menu name in child items for remove

查看:122
本文介绍了如何使用子项中的子菜单名称进行删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我创建了一个菜单,基于删除菜单项或子项的权限。



我可以使用主菜单项的名称进行删除,但是当我尝试删除子项时,不接受该字符串,只接受整数。



以下是成功使用整数作为子项位置的代码:



Hi All,

I have created a menu and based on the rights removing the menu items or child items.

I am able to use the name of main menu item for removing but when i am trying to remove the the child item the string is not accepted and only the integer is accepted.

following is the code successfully working with integer as child item location:

Menu1.FindItem("Masters").ChildItems.Remove(Menu1.FindItem("Masters").ChildItems(0))





请让我知道我怎么做用子项名称替换0即TypeMaster



谢谢



Please let me know how i can replace the 0 with name of child item i.e. "TypeMaster"

thanks

推荐答案

Thanks a lot Kschuler. It worked with a little tweaking. The forward slash had to be replaced with backslash:

Menu1.FindItem("Masters").ChildItems.Remove(Menu1.FindItem("Masters/TypeMaster"))


这篇关于如何使用子项中的子菜单名称进行删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆