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:BoundField DataField="Payment" HeaderText="Payment1" DataFormatString="{0:C}" />
<asp:TemplateField HeaderText="Payment2">
<ItemTemplate>
£<%# Eval("Payment")%>
</ItemTemplate>
</asp:TemplateField>
Result:
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.