views:

510

answers:

1

There are Two kind of template in asp.net 3.5

1) Dynamic Data Web App.

2) Dynamic Data Web App. Entities

My SQL database has got Customer Table ; Columns : ID, Name,Surname vs.

if you use first one(Dynamic Data Web App); you can not see ID column(Customer Table) (Linq to Sql)

But if you use second one(Dynamic Data Web App. Entities), you can see ID column

How can i filter column especially ID area. I mean; i need ID column visible =false

A: 

In your metadata class, set the Id to the following:

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

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

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

}

Then you need the metadata class itself. Something like:

public class MyEntityFromTable_MD
{
        [ScaffoldColumn(false)]
        public object Id;
}
miccet
How can i use this propert?
Phsika
First you create a partial class for your type, say Customer from the Northwind db. Then you add the MetadataType attribute above the class definition. Then you create the Metadata class with the ScaffoldColumn set to false for the Id. The code for it is above.
miccet