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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:52:04+00:00 2026-06-18T15:52:04+00:00

I have following expression for currency formatting inside an ASP.Net Gridview. It does not

  • 0

I have following expression for currency formatting inside an ASP.Net Gridview. It does not show dollar format though there is no error. What is the missing point here?

<%# String.Format("{0:C}", Convert.ToString(Eval("Amount")) ) %>

MARKUP

 <asp:GridView ID="grdFinancialAmount" runat="server" AutoGenerateColumns="false">
        <Columns>
            <asp:TemplateField HeaderText="Emp ID">
                <ItemTemplate>
                    <%# Eval("EmpID")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Amount">
                <ItemTemplate>
                    <%# String.Format("{0:C}", Convert.ToString(Eval("Amount")) ) %>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

CODE BEHIND

protected void Page_Load(object sender, EventArgs e)
{
    Financial fin1 = new Financial { EmpID = 1, Amount = 5678 };
    Financial fin2 = new Financial { EmpID = 2, Amount = -111111 };

    List<Financial> accounts = new List<Financial>();
    accounts.Add(fin1);
    accounts.Add(fin2);

    grdFinancialAmount.DataSource = accounts;
    grdFinancialAmount.DataBind();


}


public class Financial
{
    public int EmpID { get; set; }
    public int Amount { get; set; }
}
  • 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-18T15:52:05+00:00Added an answer on June 18, 2026 at 3:52 pm

    Why not just do either…

    <%# String.Format("{0:C}", Eval("Amount") ) %>
    

    or

    <%# ((int)Eval("Amount")).ToString("C") %>
    

    Looks to me like you are trying to convert Amount to a string twice, and you can’t format a string as currency.

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

Sidebar

Related Questions

I have the following LINQ expression that's not returning the appropriate response var query
Ok we have the following re-written URL using UrlRewriter.net /category/games/21 using the following expression.
I have the following CASE expression and the ISNULL portion is not registering: CASE
I have the following regex expression on a dev machine that is running .NET
I have the following regular expression to validate the date in 'mm/dd/yyyy' format. It
Can anyone give me the regular expression for currency which have the following formats
I have following regular expression: preg_match('/some text \d ([\d\,\s]*[A-Z0-9]\, [A-Za-ząćęłńóśźżĄĆĘŁŃÓŚŹŻ\s]*){0,5}/',$text,$results); Inside there is subpattern:
I have following regular expression: ^-?([0-9]{0,3}$|[0-9]{0,2}\.?[0-9]{0,1}$) It should not allow 4 digit number such
I have the following expression for regex. Can someone tell me what it does?
I have the following regular expression for checking the time format HHMM ([0-1][0-9]|[2][0-3])([0-5][0-9]) This

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.