I have a menu item that I am using as a toggle between listing complete and incomplete items on a grid. The menu item has a style set with bold text and a background. When I change the text in response to ItemClick the menu items retains the bold font, but does not retain the background. I have attempted to also add the cssClass back in the ItemClick event, but that doesn't work.
I could use two different menu items and the visible property, but I think this should work as is.
Style
<style> .pageItem { background-color: #e0f8c5; font-weight:bold; }
</style>
Menu Item
<ig:DataMenuItem CssClass="pageItem" Key="ListCompleteIncomplete" Text="List Complete"> </ig:DataMenuItem>
Item Click Code
Protected Sub wdmMenu_ItemClick(sender As Object, e As Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs) Handles wdmMenu.ItemClick If e.Item.Key = "ListCompleteIncomplete" Then ListCompleteIncomplete() End If End Sub Protected Sub ListCompleteIncomplete() If hdnComplete.Value = 0 Then hdnComplete.Value = 1 wdmMenu.Items.FindDataMenuItemByKey("ListCompleteIncomplete").Text = "List Incomplete" wdmMenu.Items.FindDataMenuItemByKey("ListCompleteIncomplete").CssClass = "pageItem" Else hdnComplete.Value = 0 wdmMenu.Items.FindDataMenuItemByKey("ListCompleteIncomplete").Text = "List Complete" wdmMenu.Items.FindDataMenuItemByKey("ListCompleteIncomplete").CssClass = "pageItem" End If End Sub
Hello,
Thank you for posting in our community!
The issue and explanations are not fully clear, so I would ask you for a small working sample (created as a website in VS) attached to your post where the issue is isolated and can be reproduced. By isolated I mean - all other code - unnecessary for issue reproduction should be removed. Also I would like to ask you for steps to reproduce:
1. Do this
2. do that
3. ....
Expected behavior: This should happen ....
Actual behavior: That happens ....
And because is a UI issue I would like to ask you for some screenshot if possible. This will clarify the issue and your scenario and will help us to provide you a solution.
So I ended up going with the two menu items, which is probably better, but I had that other sub from a separate button so I was attempting a shortcut. It would be nice to get an answer as to why the background style goes missing.
Protected Sub wdmMenu_ItemClick(sender As Object, e As Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs) Handles wdmMenu.ItemClick If e.Item.Key = "ListComplete" Then hdnComplete.Value = 1 wdmMenu.Items.FindDataMenuItemByKey("ListIncomplete").Visible = True wdmMenu.Items.FindDataMenuItemByKey("ListComplete").Visible = False End If If e.Item.Key = "ListIncomplete" Then hdnComplete.Value = 0 wdmMenu.Items.FindDataMenuItemByKey("ListIncomplete").Visible = False wdmMenu.Items.FindDataMenuItemByKey("ListComplete").Visible = True
End If End Sub