Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5368
WebDataMenu Itemclick event not firing
posted

I have just upgraded to the new SR.  I don't know if that has anything to do with this issue.

I have an AutoPostBack flag set for ItemClick, and I have code-behind on the ItemClick event. 

 


<AutoPostBackFlags ItemClick="On" />

It is a full page postback, and I can see the postback take place.  However, none of the code in the ItemClick codebehind is executing.

I have not had time to fully document....  has anyone else encountered this?

The only thing the least bit tricky is that I have also bound ItemClick on the client side, so that I can cancel the postback on some of the higher level menu items.  Nothing too fancy... I just do eventArgs.set_cancel(true); only for those top-level nodes.  They behave as expected and do not trigger a postback.

Parents
No Data
Reply
  • 5368
    Offline posted

    This is a bug... and it is related to the WebDataMenu being inside a WebSplitter pane.

    The following page contains two identical WebDataMenus.  One is inside a splitter pane, and the other is outside.

    Both menus are configured to only allow ItemClick to proceed if a child is clicked.  Both trigger the postback if a child is clicked.  However, the ItemClick codebehind only executes for the WebDataMenu outside the WebSplitter pane.

    TestPage.aspx
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestPage.aspx.vb" Inherits="TestPage" %>

    <%@ Register Assembly="Infragistics4.Web.v11.1, Version=11.1.20111.2064, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
        Namespace="Infragistics.Web.UI.NavigationControls" TagPrefix="ig" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript" id="igClientScript">
    <!--

            function WebDataMenu1_ItemClick(sender, eventArgs) {
                ///<summary>
                ///
                ///</summary>
                ///<param name="sender" type="Infragistics.Web.UI.WebDataMenu"></param>
                ///<param name="eventArgs" type="Infragistics.Web.UI.DataMenuItemCancelEventArgs"></param>
                if (eventArgs.getItem().get_key() == "nopostback") {
                    eventArgs.set_cancel(true);
                }

            }

            function WebDataMenu2_ItemClick(sender, eventArgs) {
                ///<summary>
                ///
                ///</summary>
                ///<param name="sender" type="Infragistics.Web.UI.WebDataMenu"></param>
                ///<param name="eventArgs" type="Infragistics.Web.UI.DataMenuItemCancelEventArgs"></param>
                if (eventArgs.getItem().get_key() == "nopostback") {
                    eventArgs.set_cancel(true);
                }

            }// -->
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ig:WebScriptManager ID="WebScriptManager1" runat="server">
        </ig:WebScriptManager>
        <div style="position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; overflow: hidden;">
            <ig:WebSplitter ID="WebSplitter1" ClientIDMode="Static" runat="server" StyleSetName="Caribbean"
                Height="50%" Width="99.9%">
                <Panes>
                    <ig:SplitterPane runat="server" Size="185px" CollapsedDirection="PreviousPane" BackColor="OldLace"
                        FrameScrolling="False" ScrollBars="Hidden">
                        <Template>
                            Inside a splitter pane
                            <ig:WebDataMenu ID="WebDataMenu1" runat="server" EnableExpandOnClick="True">
                                <ClientEvents ItemClick="WebDataMenu1_ItemClick" />
                            </ig:WebDataMenu>
                            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                        </Template>
                    </ig:SplitterPane>
                </Panes>
            </ig:WebSplitter>
            Outside a splitter pane
            <ig:WebDataMenu ID="WebDataMenu2" runat="server" EnableExpandOnClick="True">
                <ClientEvents ItemClick="WebDataMenu1_ItemClick" />
            </ig:WebDataMenu>
            <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
        </div>
        </form>
    </body>
    </html>

      

    TestPage.aspx.vb
    Imports Infragistics.Web.UI.NavigationControls

    Partial Class TestPage
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
            Response.Cache.SetCacheability(HttpCacheability.NoCache)

            If Not IsPostBack Then
                BindMenu(WebDataMenu1)
                BindMenu(WebDataMenu2)
            End If
        End Sub
        Private Sub BindMenu(menu As WebDataMenu)

            Dim itmParent As DataMenuItem

            itmParent = New DataMenuItem("Parent Item 1 (no postback)")
            itmParent.Key = "nopostback"
            menu.Items.Add(itmParent)

            itmParent.Items.Add("Child Item 1 (postback)")
            itmParent.Items.Add("Child Item 2 (postback)")
            itmParent.Items.Add("Child Item 3 (postback)")


            itmParent = New DataMenuItem("Parent Item 2 (no postback)")
            itmParent.Key = "nopostback"
            menu.Items.Add(itmParent)

            itmParent.Items.Add("Child Item 1 (postback)")
            itmParent.Items.Add("Child Item 2 (postback)")
            itmParent.Items.Add("Child Item 3 (postback)")
        End Sub
        Protected Sub WebDataMenu1_ItemClick(sender As Object, e As Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs) Handles WebDataMenu1.ItemClick
            Me.Label1.Text = "Item Clicked: " & Now.ToShortTimeString
        End Sub

        Protected Sub WebDataMenu2_ItemClick(sender As Object, e As Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs) Handles WebDataMenu2.ItemClick
            Me.Label2.Text = "Item Clicked: " & Now.ToShortTimeString
        End Sub
    End Class
Children