title: ScaffoldColumn attribute on type object
body: <p>It seems that to skip a member to come on a View you can set ScaffoldColumn attribute to false in your model</p>
  
  <pre><code>[ScaffoldColumn(false)]
  public object Id { get; set; } 
  </code></pre>
  
  <p>but here i see that Id is of object type. Is this the only way? I tried with </p>
  
  <pre><code>[ScaffoldColumn(false)]
  public int Id { get; set; } 
  </code></pre>
  
  <p>but it didn't work. How can i prevent scaffolding on a primitive type e.g. int,long etc.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I have define my model as </p>
  
  <pre><code>public class Department
  {
  [ScaffoldColumn(false)]        
          public int Id { get; set; }
  
          [Required(ErrorMessage="Name is required")]
          [StringLength(25)]
          [DisplayName("Name")]
          public string Name { get; set; }
  
          public bool Active { get; set; }
  }
  </code></pre>
  
  <p>I have a controller having action <code>Create</code>. When i right click on create action and select add view and create a strongly type view with this model it creates a view but also adds a textbox for Id</p>
  
  <pre><code>&lt;%: Html.TextBoxFor(model =&gt; model.Id)%&gt;
  </code></pre>
  
  <p>which i suppose it shouldn't have</p>