Click here to Skip to main content
Licence 
First Posted 11 Feb 2004
Views 72,313
Bookmarked 56 times

Dynamic MainMenu formation in WinForm Application using DataSet

Dynamic MainMenu formation in WinForm application using DataSet.

Sample Image - DynamicMenuDataSet.jpg

Table Of Contents

Introduction

This article demonstrates, how to form the Main menu through database based on given login user. Here I have given the table model and menu formation method. As in the previous article, which discussed XML driven menus generated at runtime, this article focuses on building menu through DataSet.

For demo purpose, I have created the DataSet in runtime.

Menu level Security

We can give the permission to user for a particular screen or action through menu, when an application is loading itself. Like what are all the menus available to the user.

Flow for Menu level Security

The following figure shows the flow of this type of security model.

Flow

Table Design

See the table design below, I have added one column USERID. I have designed this table for demo purpose. So I didn't concern about normalization. You can design your table model, but SQL query output should be like MenuID, MenuName, MenuParent, Enable and USERID format.

Table

Login Form

See the Login Form below, you can select a user from here.

Login

Menu Design

The menu will be shown like for USERID='DEMO',

DEMO

for USERID='AMAL',

AMAL

Recursive method

A recursive method CreateMenuItems has been used to create all the menu items. I have changed the CreateMenuItems little bit to use a DataSet.

Code

Conclusion

I think this shows how you can implement the security in MainMenu through database and any help, comments are much appreciated!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Amalorpavanathan Yagulasamy(AMAL)

Web Developer

United States United States

Member

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 amal_forum@hotmail.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralIn te right direction... Pinmembermalharone6:47 1 Aug '05  
Generalerror compiling solution PinmemberAntonio Barros5:34 11 Jul '04  
GeneralCool Pinmemberdevxon5:17 18 Feb '04  
GeneralRe: Cool PinmemberAmalorpavanathan Yagulasamy(AMAL)7:02 18 Feb '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 25 Feb 2004
Article Copyright 2004 by Amalorpavanathan Yagulasamy(AMAL)
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid