views:

288

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

how can i use tihs codes?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.DynamicData;


public class StaffsBusinessMetadata
{
    [ScaffoldColumn(false)]
    public object ID { get; set; }
}
+1  A: 

You'll need to add the MetadataType attribute to the partial class of the Entity type this metadata is for (in this case I assume the Entity is "StaffsBusiness").

[MetadataType(typeof(StaffsBusinessMetadata))]
public partial class StaffsBusiness
{

}

There is a lot of information on Dynamic Data Here: http://msdn.microsoft.com/en-us/library/cc488545.aspx

Aaron Hoffman