A nice to have, but the customer would be very appreciative if he/she knows that they cannot click on a menu item because of a security model.
I am using a WebMenu.
Each item has an Enabled property. If I set the Enabled property of a menu item to false than the highlight does not appear and the customer cannot click on it. Very good so far.
However, it would be nice to visually inform the customer (maybe through 'greying out' the menu item text) that - Yes we do know that you cannot select that menu item. Right now our customer base will probably think it is a bug.
We are using Infragistics 3.5 v8.3 of the UltraWebMenu and having problems with setting the DisabledStyle in C# and having the UltraWebMenu render the disabled items.
We created a wrapper C# library component for the UltraWebMenu and then set the items to be enabled / disabled in javascript or the CodeBehind of a page.
C# CODE
Infragistics.WebUI.UltraWebNavigator.UltraWebMenu ultraWebMenu = new Infragistics.WebUI.UltraWebNavigator.UltraWebMenu();
ultraWebMenu.ID = this.ID + "UltraWebMenu";
ultraWebMenu.CssClass = "WebMenu-DefaultStyle";
ultraWebMenu.WebMenuTarget = Infragistics.WebUI.UltraWebNavigator.WebMenuTarget.PopupMenu;
ultraWebMenu.DisabledStyle.CssClass = "WebMenu-DisabledStyle";
When the page finishes loading, the disabled items have no CSS. Using JavaScript, we can alert the DisabledStyle property of the Menu's JS object; the alert is an empty box. If we explicitly set the DisabledStyle in JavaScript, the disabled items of the menu appear properly.
JAVASCRIPT CODE
alert('the Disabled Class is: ' + objActionMenu.DisabledClass);
objActionMenu.DisabledClass = 'WebMenu-DisabledStyle';
alert('the Disabled Class NOW is: ' + objActionMenu.DisabledClass);
Has anyone reported problems with the DisabledStyle.CssClass property of the C# object not being properly passed into JavaScript? Or are we setting the DisabledStyle incorrectly?
Then maybe you can also try to explicitly set a different style for the Item that is being disabled, directly on its style - for example:
<ignav:Item Text="Top Item"> <Items> <ignav:Item Text="Sub Menu Item"> </ignav:Item> <ignav:Item Enabled="False" Text="Sub Menu Item"> <Styles ForeColor="#666633"> </Styles> </ignav:Item> <ignav:Item Text="Sub Menu Item"> </ignav:Item> </Items> </ignav:Item>
or directly using
UltraWebMenu1.Items[0].Items[0].Enabled = false;UltraWebMenu1.Items[0].Items[0].Styles.ForeColor = Color.Gray;
It is hard to tell what interferes with styles. UltraWebMenu renders as standard <table> <tr> <td> and if you have global CSS style settings for tables or table cells, they will be propagated to the menu cells as well. In this case the only way to go would be to redefine explicitly the styles inherited from global settings in CSS, so that they are applied only for menu items (for example if you are using Default theme, that would be)
.igmn_Item{ background-color:Transparent; border:solid 1px Transparent;}.igmn_Disabled{ font-size:xx-small; font-family: Verdana; color: gray !important!;
}
You can add your own styles there and mark them as !important (a CSS clause making sure this specific rule will stick to the item and not an inherited/cascading rule)
Rumen,
I tracked on that earlier. For some reason the control ignores the 'DisabledStyle' settings. I am currently using 2007v3. The way the control seems to be functioning is that the highlight changes as my cursor hovers over the item. When my cursor hovers over a menu item that has it's enabled property set to False that menu item is not 'Highlighted' and cannot be selected. That is a visual cue, but I think it may be confusing to new customers.
Maybe Preset I chose is interfering with it. It seems to have made two styles, but never seems to have used them. This menu is set to be a Popup menu.
Hello Roger,
I believe in this situation you can take advantage of our DisabledStyle style class - you can sent font face, size and color (for example to gray) for all disabled items on the menu. In the example below, I have set gray to be the default style for disabled items:
<ignav:UltraWebMenu ID="UltraWebMenu1" runat="server" JavaScriptFilename="" JavaScriptFileNameCommon="" LeafItemImageUrl="" ParentItemImageUrl="" StyleSetName=""> <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"> </ignav:Item> <ignav:Item Enabled="False" Text="Sub Menu Item"> <Styles ForeColor="#666633"> </Styles> </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> </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> <MenuClientSideEvents InitializeMenu="" ItemChecked="" ItemClick="" SubMenuDisplay="" ItemHover=""></MenuClientSideEvents> </ignav:UltraWebMenu>
Hope this helps.