Share via

aspx how to to format a column as Currency

Simon 426 Reputation points
4 Mar 2025, 8:46 pm

i am working on aspx page it is connected to sql my code is vb.net

in a GridView column payment how can i format in code this column as Currency

Thanks in advence

ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
393 questions
0 comments No comments
{count} votes

Accepted answer
  1. XuDong Peng-MSFT 11,656 Reputation points Microsoft External Staff
    5 Mar 2025, 2:30 am

    Hi @Simon,

    in a GridView column payment how can i format in code this column as Currency

    If you only need to use the currency symbol of the locale, you can achieve your needs through DataFormatString="{0:C}". But if it is a specific symbol, you should use TemplateField to display this part of the data. Here is a simple example:

    ASP.NET (C#)
     <asp:BoundField DataField="Payment" HeaderText="Payment1" DataFormatString="{0:C}" />
     <asp:TemplateField HeaderText="Payment2">
         <ItemTemplate>
             £<%# Eval("Payment")%>
         </ItemTemplate>
     </asp:TemplateField>
    

    Result:

    User's image

    Best regards,

    Xudong Peng


    If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.