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 7963837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:42:41+00:00 2026-06-04T05:42:41+00:00

I have been working very hard on several very long views which are attached

  • 0

I have been working very hard on several very long views which are attached to my models through “ViewModel” intermediaries. My model is in a separate project.

All works fine but some of the fields in the view I want to hide. I have used for the most part, something like this:

        <td id="Left">@Html.LabelFor(x=>x.Id)</td>
        <td id="Right">@Html.TextBoxFor(model => model.Id)</td>

for all the fields so far (there are several hundred in each view.

It doesnt make sense for me to have to go into these and change many of them to HiddenFor as I have to do it in many places.

I want to know if there is an option to put it over the property of the view model like:

    [Display(Name = "ID:")]
    [HiddenInput(DisplayValue = false)]
    public int Id { get; set; }

in order to hide both the label and the input textbox at once so only the fields I have marked show up. I am thinking that I shoudl be able to just set an attribute to do this so where am I going wrong.

Thanks in advance for any help.

  • 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-06-04T05:42:48+00:00Added an answer on June 4, 2026 at 5:42 am

    No, in your case, there is no out of box solution for that.

    There’s ScaffoldColumnAttribute that controls generation of input and label together, but it can be seen in action only when you use dynamically generated views, using EditorForModel. And this technique completely removes html, which is not the same as generating hidden inputs.

    You could try to manage that using jQuery and attribute ends with selector though

    <script>
    $(function () {
        $('input[name$="Id"]').closest('tr').hide();
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Delphi 2009. In my program, I have been working very hard to
Background We have been working very hard to try come up with solutions for
I have been working through a very small-scale WPF project in order to familiarize
I have been working very hard on figuring this out and just can't understand
I have not been working with JSON very long. I have the following response
A project I have been working on for several years apparently has gotten so
i have been trying very hard to make tinyMCE work on my page. even
I have been working with some Ajax functions. All of them are working very
I am very new to JS, have been working in C/C++ before, I need
Ok, I have been having a VERY hard time figuring this out. I guess

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.