views:

1617

answers:

3

Hi,

Is there any way to apply an attribute to a model file in ASP.NET Dynamic Data to hide the column?

For instance, I can currently set the display name of a column like this:

[DisplayName("Last name")]
public object Last_name { get; set; }

Is there a similar way to hide a column?

Edit: Many thanks to Christian Hagelid for going the extra mile and giving a spot-on answer :-)

+8  A: 

Had no idea what ASP.NET Dynamic Data was so you promted me to so some research :)

Looks like the property you are looking for is

[ScaffoldColumn(false)]

There is also a similar property for tables

[ScaffoldTable(false)]

source

Christian Hagelid
helped me almost 2 yrs later, thx!
roufamatic
Love that this is still helping people out now
Graphain
A: 

Great, it works.

dartains
+1  A: 

How can it be hidden for some templates but not others?

There is this http://csharpbits.notaclue.net/2008/10/dynamic-data-hiding-columns-in-selected.html but that seems like too much work and maybe there is an easier way?

mkamoski
I used this and it was not that difficult.
Irwin