What is Exaclty ScaffoldColumn(false)
and HiddenInput(DisplayValue = false)
?
And What are the main difference between these two ? Which one is best to use??
Thanks!!!
What is Exaclty ScaffoldColumn(false)
and HiddenInput(DisplayValue = false)
?
And What are the main difference between these two ? Which one is best to use??
Thanks!!!
[ScaffoldColumn(false)]
tells Visual Studio not to scaffold the column when generating a template for your view. When you create a new view, you can create a strongly typed view. When you do that Visual Studio asks you what template to use (Create, Edit, List, etc). If you create an Edit/Create template; for example, if you put [ScaffoldColumn(false)]
on your model property then it just won't generate a DisplayFor() or EditorFor() call in the template, so it won't be included in your view.
[HiddenInput]
will tell the DisplayFor/EditorFor methods that it should create a hidden html field for that value. When you post to a form, it will be included in the values but it will be "hidden" from the view when people look at it.