代码背后:
Menu masterpagemenu = (Menu)this.Master.FindControl("NavigationMenuAdmin");
masterpagemenu.MenuItemClick += new EventHandler(masterpagemenu_Click);
给出错误:
Cannot implicitly Convert type System.EventHandler to System.Web.UI.WebControls.MenuEventHandler
为什么会这样?
答案 0 :(得分:0)
您收到类型转换错误。它告诉您,您正在为MenuItemClick
分配错误类型的事件。 MenuItemClick
期待MenuEventHandler
,请尝试以下方式:
masterpagemenu.MenuItemClick += new MenuEventHandler(masterpagemenu_Click);