Solved

How do I get DisplayFormat to work in my View using ASP.NET MVC 3?

Posted on 2012-03-24
1
1,819 Views
Last Modified: 2012-03-25
I have the following in my model.

[DisplayFormat(DataFormatString = "{0.0}")]
public double Rating { get; set; }

I have the following in my view
@Html.DisplayFor(modelItem => item.Rating)

This is not working for me. I get an error on my page:

"Input string was not in a correct format."
0
Comment
Question by:maddhacker24
1 Comment
 

Accepted Solution

by:
maddhacker24 earned 0 total points
ID: 37764301
I solved the issue myself.

I used [DisplayFormat(DataFormatString = "{0:0.0}", ApplyFormatInEditMode = true)]
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question