ID of dynamic data objects Column visible false?

There are two types of template in asp.net 3.5

1) Dynamic Data web application.

2) Dynamic Data web application. Objects

My SQL database has a Customer table; Columns: id, first name, last name vs.

if you are using the first one (Dynamic Data Web App); you cannot see id column (customer table) (Linq to Sql)

But if you are using the second one (Dynamic Data Web App. Entities) you can see the ids column

How can I filter especially the column id field. I mean; I need column id visible = false

0


a source to share


1 answer


In your metadata class, set the Id like this:

[ScaffoldColumn(false)]
public object Id { get; set; }

      

If you don't have a reference to the metadata class, you add this by adding an attribute to the partial class, something like this:



[MetadataType(typeof(MyEntityFromTable_MD))]
public partial class MyEntityFromTable
{

}

      

Then you need a metadata class. Sort of:

public class MyEntityFromTable_MD
{
        [ScaffoldColumn(false)]
        public object Id;
}

      

0


a source







All Articles