entity-frameworkasp.net-coreasp.net-core-mvcrazor-pagesasp.net-mvc-scaffolding

CRUD Razor Scaffolded Page is not styled


After I created my entity models and I generated migrations, I made CRUD scaffolding for one of the entities, but the pages were not styled at all, and all the links weren't working, I added the following

@using Microsoft.AspNetCore.Mvc.ViewEngines
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

which only added the links and added names next to the fields Product Index Page

My product model is also associated with a model called Category which is a required field but in the create or edit pages the option to add a category foriegn key isn't available

Product Edit

How do I fix the styling problem? and is there a reason the foriegn key relation fields weren't generated, although they are generated correctly in DB?


Solution

  • the pages were not styled at all, and all the links weren't working

    Based on your description, If don't set up a layout, it may result in a page structure that isn't shared.You can check if you set layout when you use scaffolding and make sure the layout is configured correctly. If Still can't see the style of the page, You can provide relevant error messages in the developer tools.enter image description here

    the option to add a category foriegn key isn't available.

    About this problem do you want to add an item to the page that can be set as a category to add and edit related products? You can provide more detailed model code and problem descriptions to help you better.