How can i hide the attribute:
[Display(Name = "dspName")]
alternatively the variable name from my variable in the (razor) view?
My problem is that I have defined a custom template for booleans that views the boolean like:
varname/displayName: 'box'
If I create the view with:
@Html.EditorForModel(Model)
the Result is:
varname/displayName
varname/displayName: 'box'
Result in Browser:

edit: my BooleanTemplate
@model System.Boolean?
@{
string name = string.Empty;
if (!string.IsNullOrWhiteSpace(ViewData.ModelMetadata.DisplayName))
{
name =ViewData.ModelMetadata.DisplayName;
}
else
{
name = ViewData.ModelMetadata.PropertyName;
}
}
@name:
@Html.CheckBox("", Model.HasValue ? Model : Model.Value)
The additional label you are seeing is baked into the default editor template for the Object class. So you have two possibilities:
@Html.EditorFor(x => x.SomeBoolProperty)and so on for each property instead of@Html.EditorForModel()Modify the default editor template of the object class (
EditorTemplates/Object.cshtml) to remove the label (notice the part I have put in comments):