Its my understanding that by adding the ScaffoldColumn(false) annotation to an property in a class, that property will not added to the view when doing Add View. However even though i have added scaffoldcolumn false to properties i dont want added to a Create form, they are still rendered inthe create view. Is ScaffoldColumn broken? On page 552 in Pro ASP.NET MVC 3 Framework by Freeman and Sanderson, it states
“If we want to exclude a property from the generated HTML, we can use
ScaffoldColumn attribute. When the scaffolding helpers see the
ScaffoldColumn attribute, they skip over the property entirely; no
hidden input elements will be generated and no details of this
property will be included in the generated HTML.”
Also the MVC Music Store PDF on p 77 indicates that the attrtibute will do the same –
“Allows hiding fields from editor forms”.
They add it to the AlbumId property and then when the app is run AlbumId field is not shown in the browser.
Is this attr broken?
If i change a html helper to DisplayFor it does not appear in the form regardless of whether scaffoldcolumn is present. For example i dont have scaffoldcolumn false on Property PostTitle but if i change @Html.EditorFor(Function(model) model.PostTitle) to displayfor then it does not render regardless of the scaffoldcolumn attr.
Also my Create view is strongly typed to @ModelType RiderDesignMvcBlog.Core.Entities.Post
Received this answer in the asp.net forums: