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




Parents
  • 750
    Offline posted

    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

Reply Children
No Data