I have a model
class Address {
public int AddressID {get;set;}
public string Street {get;set;}
public string City {get;set;}
public string State {get;set;}
public int ZipCode {get;set;}
}
in my view, when I have
@Html.LabelFor(model => model.Address)
(assuming Address is a complex property inside another model)
I get a label for every one of Address properties, so I get:
AddressID:
Street:
City:
State:
ZipCode:
problem is, I don't want the ID property to show up, I tried these two annotations:
[Display(AutoGenerateField = false)]
[HiddenInput(DisplayValue = false)]
but the first one doesn't do anything for some reason, and the HiddenInput keeps getting a red squiggly line, not sure if they both use the same System.ComponentModel.DataAnnotations
assembly