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>
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
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!
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.
Thanks for the reply.
It looks like the difference is the master page -- I can confirm that my example works with a scriptmanager on the form page and no master page.
However, when I try to use a master page with the scriptmanager in the master page, it doesn't work. I've tried with a scriptmanagerproxy on the child page, but I'm still not able to get it to work.
Do you have an example using a master page?
Thank you,
Could you please share the sample that you mentioned with me. I will be glad to help you by investigating it further for you.
Denis, thanks very much -- that solved this issue. Initializing the handler in the OnInit method allowed the WebDataMenu click handler to fire.
I've attached the working sample for posterity.
Hello Seth,
You can use OnInit event of the Page the in order the register the handler of the ItemClick event.
Let me know if you need further assistance.
Attached is a simple web application. Default.aspx uses a master page -- the callback is not triggered. Default2.aspx does not use a master page, and the callback is triggered. It uses version 2015.1 of the ASP.NET framework, with the service release.
Thanks for looking at this.