How to detect which -sub -sub menu item was selected (UltraWebMenu).

This post has 10 Replies | 3 Followers

petejordan
Points 535
Replied On: Wed, Feb 18 2009 3:51 PM
 using UltraWebMenu . . . . I can set a break point in

UltraWebMenu_MenuItemClicked and know what was clicked . . . . but only for
top level and 1 level down menus . . .

why doesn't UltraWebMenu_MenuItemClicked fire for

-sub -sub (flyout) menu selections ???? 

Thx,

XPXJ

Infragistics35.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009

  • Post Points: 20
Replied On: Wed, Feb 18 2009 5:39 PM

HI ,

 My Client-Size Item_click event fires for all levels. The ItemId of the ItemClick event has the full path of the menu index appended to it.

 You can also get the level number by using the MenuItems getLevel method. You can also use the getText method to get the menu text.

 Here is a help link of the Client_Side object model:

 http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR2.0/html/WebMenu_Item_Object_CSOM.html

http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR2.0/html/WebMenu_CSOM_Overview.html

Here is the code to my aspx page: (I tested clr 3.5 as well)

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="Infragistics2.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %>

<!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>Untitled Page</title>

    <script type="text/javascript" id="igClientScript">
<!--

function UltraWebMenu1_ItemClick(menuId, itemId){
 //Add code to handle your event here.
 debugger;
 alert(itemId);
 var item =  igmenu_getItemById(itemId);
 alert(item.getLevel());


}
// -->
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ignav:UltraWebMenu ID="UltraWebMenu1" runat="server" JavaScriptFilename=""
            JavaScriptFileNameCommon="" WebMenuTarget="VerticalMenu">
            <IslandStyle BackColor="LightGray" BorderStyle="Outset" BorderWidth="1px"
                Cursor="Default">
            </IslandStyle>
            <HoverItemStyle BackColor="DarkBlue" Cursor="Default" ForeColor="White">
            </HoverItemStyle>
            <Images>
                <SubMenuImage Url="ig_menuTri.gif" />
            </Images>
            <ItemStyle Cursor="Default">
            <Padding Left="0px" />
            </ItemStyle>
            <Items>
                <ignav:Item Text="Top Item">
                    <Items>
                        <ignav:Item Text="Sub Menu Item">
                        </ignav:Item>
                        <ignav:Item Text="Sub Menu Item">
                            <Items>
                                <ignav:Item Text="policy">
                                </ignav:Item>
                                <ignav:Item Text="Sub Menu Item">
                                </ignav:Item>
                                <ignav:Item Text="Sub Menu Item">
                                </ignav:Item>
                                <ignav:Item Text="Sub Menu Item">
                                </ignav:Item>
                            </Items>
                        </ignav:Item>
                        <ignav:Item Text="Sub Menu Item">
                        </ignav:Item>
                    </Items>
                </ignav:Item>
                <ignav:Item Text="Top Item">
                    <Items>
                        <ignav:Item Text="Sub Menu Item">
                        </ignav:Item>
                        <ignav:Item Text="Sub Menu Item">
                        </ignav:Item>
                    </Items>
                </ignav:Item>
                <ignav:Item Text="Top Item">
                    <Items>
                        <ignav:Item Text="Sub Menu Item">
                        </ignav:Item>
                        <ignav:Item Text="Sub Menu Item">
                        </ignav:Item>
                    </Items>
                </ignav:Item>
            </Items>
            <DisabledStyle Font-Names="MS Sans Serif" Font-Size="8pt" ForeColor="Gray">
            </DisabledStyle>
            <Levels>
                <ignav:Level Index="0" />
                <ignav:Level Index="1" />
                <ignav:Level Index="2" />
            </Levels>
            <SeparatorStyle BackgroundImage="ig_menuSep.gif" CssClass="SeparatorClass"
                CustomRules="background-repeat:repeat-x; " />
<ExpandEffects ShadowColor="LightGray"></ExpandEffects>

<MenuClientSideEvents ItemClick="UltraWebMenu1_ItemClick"></MenuClientSideEvents>
            <ParentItemStyle>
                <Padding Left="0px" Right="10px" />
            </ParentItemStyle>
        </ignav:UltraWebMenu>
    </div>
    </form>
</body>
</html>

 

Sincerely,
 Matt
Developer Support Engineer

  • Post Points: 35
petejordan
Points 535
Replied On: Wed, Feb 18 2009 6:02 PM

Yes . . . I have been playing with the javascript from http://news.infragistics.com/forums/p/11040/41895.aspx#41895

Perhaps it makes a diffference that the UltraMenuBar is on a Master Page (Inherits System.Web.UI.MasterPage)

???

but I'm definitely NOT getting a break for the -sub -sub (flyout)s IN:

Private Sub CDBG_UltraWebMenu_MenuItemClicked(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebNavigator.WebMenuItemEventArgs) Handles CDBG_UltraWebMenu.MenuItemClicked

ContentPlaceHolder1.Visible = e.Item.Tag = "crs"

ContentPlaceHolder2.Visible = e.Item.Tag = "frs"

End Sub

(I will test with your code just to say I believe you).

Thx,

XPXJ

  • Post Points: 5
petejordan
Points 535
Replied On: Fri, Feb 20 2009 2:50 PM

Please note that your test proj only has 2 levels of menu-ing.

Your test does NOT replicate my situation in that you only have 2 levels of menu-ing: "Top Item" and "Sub Menu Item".

To test my situation YOU MUST HAVE A 3rd LEVEL OF MENU-ING (i.e. a "fly-out").

can you create a .ZIP of your test with 3 levels of menu-ing ?

see also: http://news.infragistics.com/forums/t/20814.aspx

=============================================================== 

BTW: my project is in VB.

can i give you my "problem" project as an attached file ?

Thx,

XPXJ

Infragistics35.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009

  • Post Points: 5
petejordan
Points 535
Replied On: Mon, Feb 23 2009 3:46 PM

It must have something to do with the involvement of a MasterPage.

In 20814 [Infragistics] Ivan Baev hasn't quite gone deep enough in menu-ing (3 levels) in his test app to exhibit the problem.

(If javascript is the only workaround any script that will toggle the visibility of the ContentPlaceHolder(s) would be greatly appreciated.)

=============================================================== 

BTW: my project is in VB.

can i give you my "problem" project as an attached file ?

Thx,

XPXJ

Infragistics35.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009

  • Post Points: 5
petejordan
Points 535
Replied On: Mon, Mar 2 2009 12:41 PM

Dear MTraynor,

  When trying to run your sample I get the following error (What assembly am I missing? I already have

Infragistics35.WebUI.Shared.v8.3, Infragistics35.WebUI.UltraWebNavigator.v8.3):

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'Style' does not exist in the namespace 'Infragistics.WebUI.Shared' (are you missing an assembly reference?)

Source Error:

Line 234: Line 235: [System.Diagnostics.DebuggerNonUserCodeAttribute()] Line 236: private void @__BuildControl__control3(Infragistics.WebUI.Shared.Style @__ctrl) { Line 237: Line 238: #line 30 "C:\PMJ - 02-11-09\INFRAGISTICS - 02-11-09\UltraWebMenu - 02-25-09\MTraynor - 03-02-09\MTraynor\Default.aspx"


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\23a5c553\2b8bb871\App_Web_default.aspx.cdcab7d2.wus_qo0b.0.cs    Line: 236

Thx,

XPXJ

Server Error in '/' Application.

Compilation Error

 

 

  • Post Points: 20
Replied On: Mon, Mar 2 2009 3:04 PM

HI,

 you added our clr 3.5 assemblies and the page's register tag is pointing to our clr 2.0 assemblies.

<%@ Register Assembly="Infragistics2.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %>

 

so either change the register tag to point to our 3.5 assemblies or add 2.0 assemblies.

Thanks you

 

 

Sincerely,
 Matt
Developer Support Engineer

  • Post Points: 20
petejordan
Points 535
Replied On: Mon, Mar 2 2009 5:30 PM

I mostly work in 3.5 now.

This is what I have . . .

(I even copied the Register from a working app as you can see but still get error). ??

 

 

 

<%

 

--<%@ Register Assembly="Infragistics35.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %>

--

 

 

%>

<%

 

@ Register TagPrefix="ignav" Namespace

="Infragistics.WebUI.UltraWebNavigator"

 

 

Assembly="Infragistics35.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

%>

?????

Thx,

XPXJ

  • Post Points: 20
Replied On: Tue, Mar 3 2009 10:31 AM

HI, your webconfig is probably missing the assemblies. A quick way to fix this issue is to create a new page and drop a webmenu onto the form, this will update your web.config file. Or just drop a webmenu onto the form you are working on.

Your web.config should look like this:  (*this is the release version of 8.3 clr 3.5*) 

 <add assembly="Infragistics35.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
    <add assembly="Infragistics35.WebUI.Shared.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>

 

 

 

Sincerely,
 Matt
Developer Support Engineer

  • Post Points: 35
petejordan
Points 535
Replied On: Tue, Mar 3 2009 12:14 PM

Dear MTraynor,

  OK. It took a new form to register the assembly in Web.Config. (just adding another UltraWebMenu ctl to page didn't). Am able to demonstrate all levels fire the ItemClick:

<

 

MenuClientSideEvents InitializeMenu="" ItemChecked="" ItemClick="CDBG_UltraWebMenu_ItemClick"

 

SubMenuDisplay="" ItemHover=""></MenuClientSideEvents>

What's happening I finally understand is the fly-out menu items are redirecting to a TargetUrl before

the Click event. And this is OK as it's actually better that we have come to a solution in which we are toggling visibility of ContentPlaceHolders in the MasterPage IN the <child>.aspx.vb rather in Master.vb (fewer files to modify when change is req'd). So all is well.

BTW: this new forum re-design is slick and all with swirly page titles of colored interstellar gas and all . . . but bottom line everything appears to take longer to respond.

Thank once again for all your help and assistance IG,

XPXJ

  • Post Points: 5
cnorton
Points 5
Replied On: Tue, Jul 21 2009 3:06 PM

Thanks this solved an issue I encountered

  • Post Points: 5
Page 1 of 1 (11 items) | RSS