Loading a Menu Programmatically based on Roles - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 17

As we continue our series, we'll look at programmatically loading a menu control.

In this example, we define our menu in the code in front, but do not add any items. All items are added in our codebehind, based on the logged in user's role.

 Dim mi As New MenuItem
            Dim currentmenucount As Integer = menu1.Items.Count

            mi = New MenuItem
            mi.NavigateUrl = "~/default.aspx"
            mi.Text = "Home"
            menu1.Items.AddAt(menu1.Items.Count, mi)

Read the entire article here...

 

No Comments