Open Closed

Parent & Child #6740


User avatar
0
nabass created

hi sir hope you are well, i want to make something like image 1 what i reached for is image 2 how can i put more values under my parent value like framework do??

  • ABP Framework version: v8
  • UI Type: MVC
  • Database System: EF Core (SQL Server)

5 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hi @nabass,

    I don't quite understand your problem, do you want to change the permission name(create, update, etc.)?

  • User Avatar
    0
    nabass created

    no no no do you see the shape of permission i want to do something like that let me give you an example

    • First
      • first-1
      • first-2
        • first -2 -0
        • first - 2-1
      • first -3
    • second
      • second-1
      • second-2

    exactly like permission how can i do this??? what i can do is *first *second

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello,

    Could you please try with this code.

    It results like

    You can add your logic as per your requirement.

    Thank you.

  • User Avatar
    0
    nabass created

    Thanks for quickly replay, but i already know how to write HTML nested checkbox list but actually i bind my checkbox list dynamically and get the data from App service , i appreciate if you provide me with how to use the following code to bind dynamically, this is the HTML Code --================== @for (var i = 0; i < Model.AccountList.Count; i++) {

     var account = Model.AccountList[i];
    
     &lt;abp-input abp-id-name=&quot;@Model.AccountList[i].isSelected&quot; asp-for=&quot;@account.isSelected&quot; label=&quot;@account.DisplayName&quot; /&gt;
     &lt;input abp-id-name=&quot;@Model.AccountList[i].DisplayName&quot; asp-for=&quot;@account.DisplayName&quot; /&gt;
    

    }

    C# Code --============= var accountLookup = await _chartOfAccountsAppService.GetAccountLookupAsync(); AccountList = ObjectMapper.Map<List<LookupDto<int>>, List<AccountViewModel>>(accountLookup.Items.ToList());

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Thank you for the information you provided. ABP supports nested permissions. You can do this as below:

    var permission1 = myGroup.AddPermission("Permission1", L("Permission:MyPermission1"));
    permission1.AddChild("Permission1.1", L("Permission:MyPermission1.1"));
    permission1.AddChild("Permission1.2", L("Permission:MyPermission1.2"));
    var permission1_3 = permission1.AddChild("Permission1.3", L("Permission:MyPermission1.3"));
    permission1_3.AddChild("Permission1.3.1", L("Permission:MyPermission1.3.1"));
    

    Result

    What is done in the background?

    If you are wondering how this is done, please check the source code link below: https://github.com/abpframework/abp/blob/3f64fee22c805d0b22f63968c07d2d1ab3b583a5/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml#L23-L55

    You can create your own structure similar to the one in the code block in the link above.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 20, 2025, 18:00