Benmakhlouf Saad

Benmakhlouf Saad

  • NA
  • 134
  • 13.3k

MVC : Display Value Insteadof The Id

Mar 31 2020 8:51 AM
Hi,
I want to Display Username instead of Userid but it should take the Userid Value
I have 2 tables : AspNetUsers and AspNetUserRoles 
  1. ViewData["UserId"] = new SelectList(_context.AspNetUsers, "Id""Id");  
  1. <div class="form-group">  
  2.                 <label asp-for="UserId" class="control-label"></label>  
  3.                 <select asp-for="UserId" class="form-control" asp-items="ViewBag.UserId"></select>  
  4. </div>  
 

Answers (2)