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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:24:11+00:00 2026-06-16T20:24:11+00:00

I followed the steps I found online to do this, but it doesn’t seem

  • 0

I followed the steps I found online to do this, but it doesn’t seem to be working. This is an MVC4 project using Razor2.

Here is my metadata class I created

public class LedgerItemValidation
{
    [DisplayFormat(DataFormatString = "{0:#,##0.00#}", ApplyFormatInEditMode = true)]
    public decimal Amount { get; set; }

    [DataType(DataType.Date), DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
    public DateTime StartDate { get; set; }
}

And here is the partial class I created so I could apply these

[MetadataType(typeof(LedgerItemValidation))]
public partial class LedgerItem
{
    ... other stuff
}

And here is where I display it on the page

@model CF.Models.LedgerItem

@Html.TextBoxFor(m => m.Amount)

From what I could see online this should be all I have to do. As I test I gave it a DisplayName also but that didn’t show up either.

Not sure what I’m missing here.

  • 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-16T20:24:12+00:00Added an answer on June 16, 2026 at 8:24 pm

    The DisplayFormat only applies to EditorFor or DisplayFor. Use

    @Html.EditorFor(m => m.Amount)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed the steps using this site : http://wiki.apache.org/nutch/RunNutchInEclipse I encountered a problem while
I have followed the steps here : I am using the default feature file.When
I'm using Eclipse 3.5.2 and when I followed the steps on this tutorial( http://developer.android.com/guide/developing/tools/adt.html
I followed some steps I found here (can't find the URL right now, sorry)
I followed the steps here and installed the composite_primary_keys gem. When I try to
I am using the authlogic gem for authentication. I have followed the steps at:
Trying to install thawte ssl onto Azure. Followed the steps as listed here and
We followed following steps and found strange output. What would be possible reasons for
I have followed the steps of this guide to install objectaid on eclipse GALILEO
I'm using this one: https://github.com/pinax/django-notification/blob/master/docs/usage.txt So, I followed all the steps. from notification import

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.