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
535
Highlight Parent Item
posted

Hi,

I would like the hover style of a parent item to stay on if a user selects a child element, even if that child is N level's deep. How can I do this?

Parents
No Data
Reply
  • 28407
    posted

    HI,

     I wrote a sample web site - I tested this code and it works.

     Here is my code-behind

     using System.Data;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Drawing;
    using Infragistics.WebUI.UltraWebNavigator;

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void UltraWebMenu1_MenuItemClicked(object sender, Infragistics.WebUI.UltraWebNavigator.WebMenuItemEventArgs e)
        {
            Item item = null;
            if (e.Item.Level == 0)
            {
                 e.Item.Styles.BackColor = Color.DarkBlue;
                 e.Item.Styles.ForeColor = Color.White;
              //  item.Styles = UltraWebMenu1.HoverItemStyle;
            }
            else
            {
                item = e.Item;
                for (int i = 0; i < e.Item.Level; i++)
                {
                    
                    item = item.Parent;
                   
                }
               item.Styles.BackColor = Color.DarkBlue;
               item.Styles.ForeColor = Color.White;
                
              //  item.Styles = UltraWebMenu1.HoverItemStyle;
            }
        }
    }
    Here is my Aspx:

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

    <%@ Register assembly="Infragistics2.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.2059, 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>
        <style type="text/css">
                    body,html,form
                    {
                                    height:100%;
                    }
    </style>

    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
            <ignav:UltraWebMenu ID="UltraWebMenu1" runat="server"
                onmenuitemclicked="UltraWebMenu1_MenuItemClicked" TargetFrame="" TargetUrl="">
                <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" />
                <Items>
                    <ignav:Item Text="Top Item">
                        <Items>
                            <ignav:Item Text="Sub Menu Item">
                                <Items>
                                    <ignav:Item Text="Sub Menu Item">
                                    </ignav:Item>
                                </Items>
                            </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="Top Item">
                        <Items>
                            <ignav:Item Text="Sub Menu Item">
                            </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>
                </Items>
                <DisabledStyle Font-Names="MS Sans Serif" Font-Size="8pt" ForeColor="Gray">
                </DisabledStyle>
                <Levels>
                    <ignav:Level Index="0" />
                    <ignav:Level Index="1" />
                </Levels>
                <SeparatorStyle BackgroundImage="ig_menuSep.gif" CssClass="SeparatorClass"
                    CustomRules="background-repeat:repeat-x; " />
    <ExpandEffects ShadowColor="LightGray"></ExpandEffects>
            </ignav:UltraWebMenu>
       
        </div>
        </form>
    </body>
    </html>

Children
No Data