Ammarqqq 0 Newbie Poster

Hi,
I have successfully managed to include them enus on my site. I have included the follwing code in the page load event of Site Master.cs-But there is one problem. Whenever, I Try to perfrom any action in the pages corresponding to the sub menus. new admin is being called and created .
For example, If i click Role Assignment Menu.it opens the new pages, and I try to assign user to to soem specified role, . It resulted in the duplication of the whole admin menu.In other words,its being created again and again.

Kindly have a look at the code,I am pretty disturbed with this bug, I am doing something wrong over here,not figuring it out :(

/////////////////////////////////////////////////////
if (Roles.IsUserInRole("Admin"))
        {

           MenuItem adminMenu = new MenuItem("Admin",null,null,"~/Admin/Admin.aspx");

            MenuItem roleAssignSubMenu = new MenuItem("Role Assignment", null, null, "~/Account/AdminAssignRoles.aspx");
            MenuItem appUserSubMenu = new MenuItem("Approve User", null, null, "~/Account/ApproveUsers.aspx");
            MenuItem createUserSubMenu = new MenuItem("Create User", null, null, "~/Account/CreateUser.aspx");
            MenuItem notifyUsersSubMenu = new MenuItem("Notify Users", null, null, "~/Account/NotifyUsers.aspx");
            NavigationMenu1.Items.Add(adminMenu);

            adminMenu.ChildItems.Add(roleAssignSubMenu);
            adminMenu.ChildItems.Add(appUserSubMenu);
            adminMenu.ChildItems.Add(createUserSubMenu);
            adminMenu.ChildItems.Add(notifyUsersSubMenu);


        }
        else
        {
            MenuItem UserSettingsMenu = new MenuItem("User Settings", null, null, "~/Account/ChangePassword.aspx");
            NavigationMenu1.Items.Add(UserSettingsMenu);

        }