Base solution for your next web application
Open Closed

LookUp Cascade #11960


User avatar
0
Bernard created

Hi,

I would like to call an entity based on the Id value of another. For example: to create a quote, I need a Person entity of type Company "Amazon", once this company is selected I would like to be able to access a loopup control which will look for a Person entity of type Physical "Jeff Bezos" , the link is made via a ParentId The second combo (child) should be available only after selecting the first (parent). I hope to have been clear

Thank you so much

` [AbpAuthorize(AppPermissions.Pages_Conventions)] public async Task<PagedResultDto

   var totalCount = await query.CountAsync();

   var personList = await query
       .PageBy(input)
       .ToListAsync();

   var lookupTableDtoList = new List<ConventionPersonLookupTableDto>();
   foreach (var person in personList)
   {
       lookupTableDtoList.Add(new ConventionPersonLookupTableDto
       {
           Id = person.Id,
           DisplayName = string.Format("{0} {1} {2}", person.Intitule, person.CodePostal, person.Ville)
       });
   }

   return new PagedResultDto<ConventionPersonLookupTableDto>(
       totalCount,
       lookupTableDtoList
   );

} `


3 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @Bernard,

    We currently do not have any content about cascade dropdowns. But you can look at this blog post or others to implement cascade dropdowns. You may need to do some customization for use with lookup tables. I hope it helps.

    https://dotnettutorials.net/lesson/cascading-dropdown-list-in-asp-net-core-mvc/

  • User Avatar
    0
    Bernard created

    How can I find selected lookup id ?

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    There is a callback and return selected id.

    Here is an example

    _ProductcategoryLookupTableModal.open(
        {id: product.categoryId, displayName: product.categoryDisplayProperty},
        function (data) {
            _$productInformationForm.find('input[name=categoryDisplayProperty]').val(data.displayName);
            
            // data.id is selected category's id
            _$productInformationForm.find('input[name=categoryId]').val(data.id);
        },
    );