AXISHK
asked on
How does the currency symbol displayed in ASP using DataFormatString="{0:c}"
Have any idea how the currency symbol is displayed in ASP.NET using DataFormatString="{0:c}".
I try to run a sample program on a local SQL 2005 Express and the currency is displayed as UK pound sign. I want to change it to "$" sign but couldn't where should I configure it ?
Thank
I try to run a sample program on a local SQL 2005 Express and the currency is displayed as UK pound sign. I want to change it to "$" sign but couldn't where should I configure it ?
Thank
ASKER
Thanks but how will it be displayed in ASP using DataFormatString="{0:c}" by default. Will it follow the regional currecny setting in Window, or in SQL server database / tables (where) ?? I take a look for the Regional setting in Window and my currency is set to HK$. However, the ASP display UK dollar ....
Thanks.
Thanks.
It should use your regional settings in Windows. Try with the code above to see if it goes to dollar when using Format
ASKER
Yes, it could display as $ sign right now.
But I still want to know which settings cause all my ASP currency sign to display a UK pound sign. Window Regional Settings currency is already set to HK$. Hence, I could easily customize the right currency by setting the Window (or SQL or IIS) without need to put any coding on the ASP page.
Thanks
But I still want to know which settings cause all my ASP currency sign to display a UK pound sign. Window Regional Settings currency is already set to HK$. Hence, I could easily customize the right currency by setting the Window (or SQL or IIS) without need to put any coding on the ASP page.
Thanks
Hey,
It uses the currency of the user that views the website, or depending on impersonation the local machine account.
I found this :
Unless you specifically impersonate some user, the impersonating user
is the same as the authenticating user. In addition, the logged-on user
refers to the person who is logged on to the server,
-------------------------- ---------- ---------- ---
In IIS, by default, the authenticating user is the IUSR_MachineName account
(known in some OSs as the Internet Guest Account). When this account is
created, it is created with the default regional settings
It uses the currency of the user that views the website, or depending on impersonation the local machine account.
I found this :
Unless you specifically impersonate some user, the impersonating user
is the same as the authenticating user. In addition, the logged-on user
refers to the person who is logged on to the server,
--------------------------
In IIS, by default, the authenticating user is the IUSR_MachineName account
(known in some OSs as the Internet Guest Account). When this account is
created, it is created with the default regional settings
ASKER
Thanks.
The autenticating user is ASPNET on my XP. So, does it mean I couldn't change the regional setting for this account without uninstall / install the ASP.NET again ??
The autenticating user is ASPNET on my XP. So, does it mean I couldn't change the regional setting for this account without uninstall / install the ASP.NET again ??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To set the currency in .net, we can set the globalication's culture info
of the current Context via
System.Thread.CurrentThrea
System.Thread.CurrentThrea
the former is for date and currency's localization formatting
and the latter is for UI's localization
This should probably do the trick :
private void Page_Load(object sender, System.EventArgs e)
{
System.Threading.Thread.Cu
decimal dec = 4343.34343434M;
Response.Write( String.Format("{0:c}",dec)
}
hope this helps