![]() ![]() In this demo application, we have already all the needed controllers and view to be displayed when user clicks on the menu. USE_YN = 'Y' (This is optional field as we can use this as to display menu or not)ĬreatedDate = getDate() (This also optional as to input the Crete date) MenuURL = 'ADMINC' (Here we give our Controller name to be displayed when the menu is clicked) ,MenuFileName = 'INDEX' (Here we give our View name to be displayed when the menu is clicked) The same menu details as 'Manager Dashboard' for both Admin and Manager User as both can view the menu and page.) then we will insert the same menu details with different user roles. User_Roll = 'ADMIN' (Here we will give the User Role, if the same menu needs to be used for multiple roles based users like Admin, Manager, Accountant and etc. Parent_MenuID = '*’ (If this is main menu then we will give here as “*” else we will give the MenuID of previous records to display this record to show as submenu) MenuName = 'ADMIN Dashboard' (We will give menu display text), MenuID = 'AUSER' (We will give unique menu ID) Here we can see the format we are using in our Menu Master table to insert our records for display menu based on user role. First, download and install Visual Studio 2017 from this link.If not, download and install all, one by one. Make sure you have installed all the prerequisites on your computer. Display menu dynamically based on logged in user.Redirect unauthenticated users to the login page.Create MenuMaster table and insert a few sample records for Admin and Manager roles to display menus.Create default admin and manager users.For this, we will create a Menu Master table and insert a few records to display the menu and link the URL to the menu based on the logged in user's role. In this article, we will see in detail how to display role-based dynamic menu after a user logs in. In the previous article, we have discussed in detail about how to use ASP.NET Core Identity in MVC Application for creating user roles and displaying the menu depending on user roles. Getting Started With ASP.NET Core 2.0 Identity And Role Management.Public IEnumerable AllGenders ”,item.IconClass,item.Before we start this article kindly read the previous article, So, create two models within the Models folder with the name Gender and Branch and then copy and paste the following code. Creating Models:įirst, we need to create two enums to store the Gender and Branch of a student. If you change the order, then the navbar toggle button does not work as expected. On a small screen device, for the navbar toggle button to work, the jQuery reference must be loaded before loading the Bootstrap JavaScript file. Please modify the _Layout.cshtml file as shown below. Please modify the _ViewImports.cshtml file as shown below. How to Use Bootstrap in ASP.NET Core MVC.How to Install Bootstrap in ASP.NET Core MVC. ![]()
0 Comments
Leave a Reply. |