Home > other >  SQL Server database set, configs set - but data from database not displaying with @Html.DisplayFor&l
SQL Server database set, configs set - but data from database not displaying with @Html.DisplayFor&l

Time:10-17

I have a question to ask about the SQL Server, Visual Studio and the Entity Framework and how it can update the Model-view with the use of @HTML.DisplayFor<>().

Currently everything is set up as it should be:

  1. DbContext is good (Primary key is setup, alongside OnModelCreate(ModelBuilder modelBuilder))
  2. SQL Server (local) is good
  3. Migrations is good (and is showing up in SQL Server in VS2022)

... So pretty much the IIS Server is able to show my ASP.NET Core web-app without any debug/error information. It just won't show my elements in a DisplayFor<>().

My team and I are kind of perplexed, can someone please help us out? Thank you in advance.

CodePudding user response:

I solved it!

I wasn't updating the Controller which was controlling the:

[HttpGet(IndexExample.cshtml)]
public IActionResult GetIndex()
{
    var model = new IndexModel {
        IndexSubclassGetSetSyntacticSugared = new IndexModel.IndexSubclass()
    };
    return View(model);
}
  • Related