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
750
Changing menu item text loses style
posted

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