I am sorry that you did not understand my question, I need the menu Items to be displayed or not at runtime in accordance with the person who has logged into the page.
ie
If a person logs into the page the system has to check whether it he is admin or staff or a manager.and then has to make decision whether to enable all menu items or to hide some items if the person is not a admin
any help?
I think the part that isn't being said is that you have to manually turn each and every menu option on or off. There isn't an 'automatic' way of doing it.
1. The user logs in
2. That loads their permissions from someplace. Might be database, file, registry, whatever you decide.
3. As JoeDeene suggested, hold their permissions in a series of booleans. For example "bShowConfirmDialogs", "bAllowChangeUsers", "bAllowExitApp"
4. Once logged in set all the booleans from their permissions.
5. Go to a method that turns on features and menus according to the booleans.
I usually have a series of statements like this....
- closeToolStripMenuItem.Visible = bAllowExitApp;
-
edituserToolStripMenuItem.Visible = bAllowChangeUser;
Also, don't forget there is more than one way to do many things, like exit an application. Just because you take away the File|Exit choice there is also the big red 'X' button as well as [ALT]+[F4], and closing from the task bar. So you have to make sure you check the bAllowExitApp permission when the application is closing. If there is a way around something, some user will find it. You have to cover all the bases.