ID MENU_NAME PARENT_ID URL ICON ORDER
Zero NULL NULL system 1
Other NULL NULL set 1 2
3 1 User/User management Index NULL 3
4 test set 2 OtherTest/Index NULL 4
The following code is the code for the front desk, but can only generate 2 levels of menus, cannot generate multi-stage, a great god give a idea how to generate multilevel menu
@ the if (menus!=null)
{
Foreach (var module in menus. OrderBy (x=& gt; X.o. RDER.) Where (o=& gt; O.P ARENT_ID=="0"))
{
{
@ menu. MENU_NAME
}
}
}
CodePudding user response:
You the @ foreach is not necessary to write, control directly recursive call myself to go,