ASP.NET CORE MVC Lookup showing keys instead of names

Anonymous
2023-05-24T15:06:51.77+00:00

I used the below article and scaffolded db first using postgres.

In this case for one page it geenerated keys rather than names .

See the screenshot I updated the lookup fields to names in Index page but don't know how to update for other pages like create as it it still shows keys

https://medium.com/@ankushjain358/entity-framework-core-with-postgresql-database-first-ab03bf1079c4

Capturepostgres2.JPGCapturepostgres1.JPG

Here is postgres sql create scripts

postgrestb.txt

https://github.com/KalyanAllam/SISPostgres

Here is the mvc code generated using sql server

https://github.com/KalyanAllam/StudentInformationSystemscript SQL.txt

Developer technologies ASP.NET ASP.NET Core
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-05-26T10:49:08.05+00:00

    I changed the value , initial it is key, key(studentid,studentid) I changed to key value (studentid,lastname)and it worked

      ViewData["Studentid"] = new SelectList(_context.Students.Where(e => e.Studentid == sid), "Studentid", "Lastname", enrollment.Studentid);
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.