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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:37:24+00:00 2026-05-26T02:37:24+00:00

So we are having a discussion on the merits of the default generated views

  • 0

So we are having a discussion on the merits of the default generated views in MVC3. It wraps model fields like this;

    <div class="editor-label">
        @Html.LabelFor(model => model.SenderMessage)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.SenderMessage)
        @Html.ValidationMessageFor(model => model.SenderMessage)
    </div>

A coworker says the editor-label div shouldn’t be there. The label element has sufficient semantic meaning. He wants to see it like this:

  <p>
        @Html.LabelFor(model => model.SenderMessage)
        @Html.EditorFor(model => model.SenderMessage)
        @Html.ValidationMessageFor(model => model.SenderMessage)
  </p>

If it were up to me, I’d probably lean toward something like this. (Yes, I know I can customize it with t4.)

<div class="model-field">
   <div class="editor-label">
       @Html.LabelFor(model => model.SenderMessage)
   </div>
   <div class="editor-field">
       @Html.EditorFor(model => model.SenderMessage)
       @Html.ValidationMessageFor(model => model.SenderMessage)
   </div>  
</div>  

Why is the first way better than the second two ways?

  • 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-26T02:37:25+00:00Added an answer on May 26, 2026 at 2:37 am

    Frameworks such as MVC3 try to be everything to everyone. As a result the code they generate often ends up being somewhat over-engineered.

    This applies to virtually every framework, CMS and site designer application out there; if you look at the generated code for the vast majority of sites on the web, you’ll see over-structured HTML because it’s been created by a code generator rather than being hand-written.

    In many cases it is possible to change the templates or the engines to generate cleaner code, but there are usually good reasons why the generators default to creating the code they do.

    For example, consider a site that performs some clever jQuery effects on the labels and fields. Some effects might be a lot easier to achieve with the wrapping <div> elements in place.

    The framework designers have taken the cautious approach and over-structured it, because this gives the most flexibility for their end users (ie developers) to work with it in different ways. Cleaner HTML might be nicer from a purists point of view but impact of the additional markup is low, and the added flexibility is a clear win.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having this discussion with my brother, and it looks like none of
We were having this discussion wiht my colleagues about Inner assignments such as: return
We're having this discussion here. Which is better and why? 1) a php file
I'm having trouble getting ThinkingSphinx to recognize my conditions. My Discussion model includes the
I was having a discussion about this with a co-worker and we couldn't come
I don't know if this has been asked before, but we're having a discussion
I was having this discussion with my friend and realized this might be the
We are having this discussion in our team about code conventions for Java for:
I'm having this code: <ul> <div> </div> </ul> I feel no issue in my
My coworkers and I were having a discussion about this yesterday. It seems that

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.