Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6060351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:48:56+00:00 2026-05-23T08:48:56+00:00

How can i hide the attribute: [Display(Name = dspName)] alternatively the variable name from

  • 0

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:

html output

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)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:48:57+00:00Added an answer on May 23, 2026 at 8:48 am

    The additional label you are seeing is baked into the default editor template for the Object class. So you have two possibilities:

    1. Use @Html.EditorFor(x => x.SomeBoolProperty) and so on for each property instead of @Html.EditorForModel()
    2. Modify the default editor template of the object class (EditorTemplates/Object.cshtml) to remove the label (notice the part I have put in comments):

      @if (ViewData.TemplateInfo.TemplateDepth > 1) 
      { 
          @ViewData.ModelMetadata.SimpleDisplayText
      }
      else 
      {
          foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !ViewData.TemplateInfo.Visited(pm))) 
          {
              if (prop.HideSurroundingHtml) 
              {
                  @Html.Editor(prop.PropertyName)
              }
              else 
              {
                  @*if (!String.IsNullOrEmpty(Html.Label(prop.PropertyName).ToHtmlString())) 
                  {
                      <div class="editor-label">@Html.Label(prop.PropertyName)</div>
                  }*@
                  <div class="editor-field">
                      @Html.Editor(prop.PropertyName)
                      @Html.ValidationMessage(prop.PropertyName, "*")
                  </div>
              }
          }
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have div in aspx page with the runat=server attribute. How can I hide
Is there a control like System.Windows.Controls.GroupBox that can hide its contents and show only
I come from the Java world, where you can hide variables and functions and
How can I hide parts of a class so that whoever is using the
I have a UIView with a navigation bar. How can I hide the navigation
I need to hide a Windows form from the taskbar but I can't use
I have a managedObject with an attribute that is a Boolean. I need to
If all tables I want to delete from have the column gamer_id can i
How can I hide the grid lines separating empty cells from the adjacent cells
How I can hide View text and page navigation in a jQuery grid navigator?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.