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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:29:57+00:00 2026-06-06T07:29:57+00:00

The default DisplayFor helper just throws some escaped text on the page. Is there

  • 0

The default DisplayFor helper just throws some escaped text on the page. Is there a way to wrap the default in a <span> or <div> without writing custom DisplayFor templates for each property you want to display? Instead of it spewing out

Foo

I want it to spit out

<span>Foo</span>

I’ve seen a lot of articles for making the custom stuff; I use those quite often. But most of my display stuff I just want to handle with simple CSS where the content is wrapped in a tag, and I can’t find a reference on how to do this, or even if it’s possible.

  • 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-06T07:30:00+00:00Added an answer on June 6, 2026 at 7:30 am

    Sure use the ‘object’ template and override as follows from ViewData.ModelMetadata.Properties
    Object template – Html.Display using ViewBag

    By having your display template named object.cshtml you will apply to all types with numerable properties

    There’s a link to brad wilsons entry that contains the primary details
    http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-3-default-templates.html

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

Sidebar

Related Questions

By default, the ordered list looks like this: There are some spacing on the
In default.aspx page, there is a user control side_menu.ascx. This is part of the
The default strongly-typed Edit page in ASP.NET MVC 3 generally exposes all fields for
default condition alt text http://shup.com/Shup/330969/1104593215-My-Desktop.png After clicking on Sitemap link How to write HTML
By default, simple_form generates error messages in this form: <span class=error>error_text</span> but what i
The default user registration page in Drupal 7 has fields to enter a username,
By default Commerce Server's pipelines log to %WEBROOT%\pipelines\log , is there a configuration value
In jQuery there is $.extend() function. That basically works like matching default settings with
By default Gson uses fields as a basis for it's serialization. Is there a
I've created a default MVC 3 project and created the default edit page for

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.