If our Winform application is having Menu level security, we can build the Main menu using XML in following way.
Like ASP.Net Tree control, we can build the Main menu using XML in runtime. For that i have created three methods,
and one event.
Here the method CreateMenu is used to create all menu items by using CreateMenuItem and CreateMenuItems.
CreateMenuItem is used to create Top level menuitems and CreateMenuItems is used to create all child level menuitems.<v:shapetype coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> The following figure shown the XML file format.
CreateMenuItems is a recursive method, so you can include n-level menuitems.
The menu will be shown like,
And Menu_Click event is used to configure the all menu item events.
I think this shows how you can implement the security in MainMenu and any help, comments are much appreciated!
Amalorpavanathan Yagulasamy (AMAL) is a Software Engineer for Protech Solution Inc. and has designed and implemented projects for Arkansas Child Support, Arkansas Budgetting, Michigan Child Support , Massachusetts Child Support, National Informatics Center-India and Indian Oil Corporation. His background is in developing relational databases and n-tier applications on Windows platforms in CMM Level Standards. He can be reached at firstname.lastname@example.org