1

I want to display a Indain rupee symbol in my web-site. in my grid view when I use DataFormatString="{0:c2} it is showing $ symbol.

so any one tell me how to solve this problem

Pankil Agrawal
  • 101
  • 1
  • 1
  • 11

3 Answers3

3

You would be better off by setting the culture.

This can be done site-wide in the web.config, using the <globalization uiCulture="in" culture="in-IN" /> element, or at the page level in the page directive <%@ Page UICulture="in" Culture="in-IN" %>

(it is in-IN or hi-IN am not too sure)

Or simply this for one-off scenario: DataFormatString = ₹ + "{0:c2}";

Abhitalks
  • 27,721
  • 5
  • 58
  • 81
  • thank you very much for ans. I have changed my code to <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" CodeFile="Search.aspx.cs" Inherits="Search_aspx" Title="Search" UICulture="hi-IN" Culture="hi-IN" %> – Pankil Agrawal Oct 11 '13 at 06:47
1
<system.web>
    <globalization culture="en-IN"/>
</system.web>

/* To get a Rupees Symbol in WebForm include in system.web File under Web.Confiq */

SurajPanda
  • 11
  • 1
0

Setting the UICulture to hi and Culture="hi-IN" will display the Hindi Symbol: रु for Rupees. [ Hindi is a language of India ]

If you want to display the symbol for an Indian Rupee, you can set the CultureInfo and customize the currency sign for the Culture.

// Override the InitializeCulture() method in your code behind file.

protected override void InitializeCulture()
  {

     CultureInfo ci = new CultureInfo("en-IN");
     // assign your custom Rupee symbol of your country
     ci.NumberFormat.CurrencySymbol = "&#8377;";
     Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture 
                                            = ci;

     base.InitializeCulture();
  }

Now in your GridView you only need to specify the DataFormatString="{0:C}" and HtmlEncode as false.

<asp:BoundField DataField="UnitPrice" DataFormatString="{0:C}"
     HtmlEncode="false" />
R.C
  • 10,417
  • 2
  • 35
  • 48