1

I am using CRUD Scaffolding in ASPNETCORE, I have a model, and in this model I want some fields to be displayed only in Details page and not in Index Page, using [ScaffoldColumn(false)] attribute disables scaffolding in both pages, is this possible?

  • Please edit your question adding code snippet and more information, please read this https://stackoverflow.com/help/how-to-ask, it will help you ask better questions. – Norcino May 08 '19 at 08:13

1 Answers1

0

Simply, no. Scaffolding just looks at the class and adds stuff for all the properties there (except the ones you've explicitly ignored). However, the class is the class, so you can't ignore something in one instance and not in another. Frankly, there's not a whole lot of configurability for something like this because it's entirely unnecessary. I honestly wasn't even aware that the ScaffoldColumn attribute existed, and I find it odd that it does considering the extremely limited utility and the fact that it requires you to add stuff to the class that has no place in the domain. Without the the attribute, you simply edit the view and remove the HTML for whatever property you don't want there. It's not exactly a big deal, and scaffolding is intended to be modified. It's not supposed to just be the end. Think of it in terms of where it comes from: construction. In what scenario would you put up the scaffolding for a building and then just walk away. The scaffolding just makes it easier to build the building, but you still need to build it.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444