Olivier Muhring

Olivier Muhring

  • NA
  • 150
  • 8.6k

How do I work with multiple Comboxes in an ASP .NET Core MVC Form?

Dec 21 2020 11:09 PM

I have an ASP .NET Core MVC web page that shows the names of jurors within a panel. The number of panels or jurors aren't fixed, so basically I build the view by looping through the available panels and then by looping through the available jurors: 

  1. @foreach (var panel in Model.PanelComposition)    
  2. {    
  3.     <div class="row">    
  4.         <div class="col">    
  5.             <p class="font-weight-bold">@panel.Functie:</p>    
  6.         </div>    
  7.         <div class="col">    
  8.             @panel.JuryName    
  9.         </div>    
  10.     </div>    
  11. } 
For every juror, I display his/her function and full name.

The next step would be to create an edit page for the same data, the idea being to offer a listing of all available jurors through combo boxes. But, I would then have to create a combo box for each available function and post the data back to the controller so I can save the data.

I'm basically wondering how I would do this in a safe & elegant fashion?


Answers (1)