The WebDataMenu ItemClick events are not working for me when they are registered dynamically. The events do work when set statically in the page markup.
This is motivated by an upgrade of a legacy application using UltraWebToolbar, which was working. I'm using version 2014.2 (I haven't tried 2015.1 yet).
Anyone else see this issue?
Thanks,
Seth
****************************
It can be demonstrated with a simple ASP.NET page:
CS section:
protected void Page_Load(object sender, EventArgs e) { WebDataMenu1.ItemClick += new Infragistics.Web.UI.NavigationControls.DataMenuItemEventHandler(Control_ButtonClicked); } public void Control_ButtonClicked(object sender, Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs be) { int i = 1; }
ASPX section:
<ig:WebDataMenu ID="WebDataMenu1" runat="server" EnableScrolling="false" AutoPostBackFlags-ItemClick="On"> <GroupSettings Orientation="Horizontal" /> <Items> <ig:DataMenuItem Text="Test"> </ig:DataMenuItem> <ig:DataMenuItem Text="1"> </ig:DataMenuItem> <ig:DataMenuItem Text="2"> </ig:DataMenuItem> <ig:DataMenuItem Text="3"> </ig:DataMenuItem> </Items> </ig:WebDataMenu>
I have created a sample in order to try to reproduce the issue that you've described and the event is fired on both scenarios (if I click the root item only).
Could you please have a look at the attached sample and let me know what I am missing?
Looking forward to hearing from you.
Zdravko, thanks for the reply.
If I used an event callback specified in the aspx page it works, eg:
<ig:WebDataMenu ID="WebDataMenu1" runat="server" OnItemClick="Control_ButtonClicked"> <GroupSettings Orientation="Horizontal" /> <Items> <ig:DataMenuItem Text="1"> </ig:DataMenuItem> <ig:DataMenuItem Text="2"> </ig:DataMenuItem> <ig:DataMenuItem Text="3"> </ig:DataMenuItem> <ig:DataMenuItem Text="4"> </ig:DataMenuItem> </Items> </ig:WebDataMenu>
But if I instead assign the callback in code (Page_Load method) it doesn't work, eg:
<ig:WebDataMenu ID="WebDataMenu1" runat="server"> <GroupSettings Orientation="Horizontal" /> <Items> <ig:DataMenuItem Text="1"> </ig:DataMenuItem> <ig:DataMenuItem Text="2"> </ig:DataMenuItem> <ig:DataMenuItem Text="3"> </ig:DataMenuItem> <ig:DataMenuItem Text="4"> </ig:DataMenuItem> </Items> </ig:WebDataMenu>
...
public partial class _Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { Infragistics.Web.UI.NavigationControls.WebDataMenu menu = this.WebDataMenu1; menu.ItemClick += new Infragistics.Web.UI.NavigationControls.DataMenuItemEventHandler(Control_ButtonClicked); } protected void Control_ButtonClicked(object sender, Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs be) { int i = 1; }
Any ideas?
Thank you!
Hello,
Thank you for contacting us.
Only the root items will trigger the ItemClick server event. For more information have a look at the references below:
http://stackoverflow.com/questions/15892055/menusitems-of-webdatamenu-no-event-fires-on-the-server
http://ko.infragistics.com/community/forums/p/25287/92715.aspx
WDM server events - http://ko.infragistics.com/samples/aspnet/data-menu/server-side-events
WDM client events - http://ko.infragistics.com/samples/aspnet/data-menu/client-side-events