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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:51:36+00:00 2026-05-26T03:51:36+00:00

Using MVC 3 @html.EditorForModel , the auto-generated template spits out <div class=editor-label>…. <div class=editor-field>….

  • 0

Using MVC 3 @html.EditorForModel, the auto-generated template spits out

<div class="editor-label">....
<div class="editor-field">....
<div class="editor-label">....
<div class="editor-field">....

Both classes are floated left so that the elements fit the horizontal space.

When the list of fields is about 10, the lines sometimes break between label and input; this looks bad.
What is the best way to keep them on the same line? If I were coding manually, I could wrap them inside another div, such as

<div class="editor-wrap">....
    <div class="editor-label">....
    <div class="editor-field">....

and float “editor-wrap”. However, in keeping with not wanting to hand-code each page, is there some way to enhance/change the behaviour of EditorForModel? Or can something be done at the .cshtml (view) level with a custom class?

  • 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-26T03:51:36+00:00Added an answer on May 26, 2026 at 3:51 am

    You can completely customize the templates MVC uses. In your Views/Shared/EditorTemplates directory, for example, you can create a template named Foo.cshtml (or whatever view engine you are using). When you call EditorForModel you can pass the name of the template (it is a parameter on one of the overloads). I recommend this series of articles to really understand the whole process:

    http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-1-introduction.html

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

Sidebar

Related Questions

I'm using MVC 2, and the Html.EditorForModel() to allow me to display an editor
I'm using MVC to validate some html text boxes on a page, for example
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
Using asp.net MVC I'd like to do this inside a view: <%= Html.TextBox(textbox1, null,
I am using asp.net MVC. I have control like <%= Html.TextBox(username) %> I want
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I'm trying to output the following html using an html helper in asp.net mvc
I have a PHP site using MVC, which builds HTML dynamically for most requests.
Using MVC, I have an html form helper in my view: using (Html.BeginForm(ActionOne, ControllerOne))
MVC @Html.TextBoxFor(model => model.SomeNotNullableType) When using this helper, if I have a type 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.