Hide Attribute hides property from Table, but Hide Method doesn't

Nov 11, 2011 at 5:27 PM

The Hide attribute hides a property from the Table view, but a Hide method doesn't. 

Is this by design or an oversight?

Nov 11, 2011 at 5:36 PM

By design.  A Hide method can be dynamic, based e.g.  on the state of the object.  A table view must assume, therefore, that the property could be visible on some of the rows. 

Nov 17, 2011 at 11:01 AM

Would it be possible (maybe desirable/maybe not) to check the hide method for each instance that is to be shown on the page prior to rendering the table html?

Nov 17, 2011 at 5:14 PM

It would be possible, but given the extra overhead this would create I don't think it is justified.  If you want to have dynamic Hide methods on individual properties, but don't want that column ever displayed in a given table then you have two options:

1.  Custom View (which I try to avoid wherever possible)

2. (Probably my preference).  Hide the whole collection.  Define an interface that specifies only the properties you want shown in the table.  Make the type(s) in the collection implement that interface.  Create a derived (ReadOnly) collection property that casts the collection to a collection of that interface.