Changing the BackColor of an ASP MenuItem programmatically?

I"m using VB.Net and I have a master page that contains an asp Menu control that contains 7 parent items. What I'm trying to do in the code-behind file is change the backcolor of each parent item except 1 (which is a "Login" menuItem). I have a For Loop that disables each menu item until the user has successfully logged in, however, I want to change the backcolor also to visually let the user know they are or are not logged in. How can I do this? My code is below.

    Private Sub DisableMenu()
        Try
            For Each mnu As MenuItem In Menu1.Items
                If mnu.Value = "mnuLogin" Then
                Else
                    'Change the BackColor for each Parent Item
                    mnu.Enabled = False
                End If
            Next

        Catch ex As Exception
            lblMessage.Text = dbIO.DisplayError("DisableMenu()", "SiteMP", ex.Message)
        End Try
    End Sub

Open in new window

BlakeMcKennaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gamarrojgqCommented:
Hi,

MenuItem does not have a BackColor property, but you can use the DrawItem Event to do it

http://msdn.microsoft.com/en-us/library/system.windows.forms.menuitem.drawitem.aspx#Y300
0
MlandaTCommented:
0
HainKurtSr. System AnalystCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BlakeMcKennaAuthor Commented:
I think I'll try another route altogether. Thanks for the input though! You can close this quesiton.
0
MlandaTCommented:
Experts have already provided solutions to the problem as it was posted. The fact that the poster eventually decided to change the architecture of his application should not prejudice the experts that provided solutions to the presented scenario.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.