Tuesday, October 6, 2009

Show Currency with different locate in Sharepoint Data View Web Part

Suppose you’d like just a single DVWP to display numbers (either currency or regular numbers) in a different locale than the host site. This trick lets you do just that.

1. Open the page you need to customize with Sharepoint Designer. Switch to code view. Perform a search to find the tag xsl:decimal-format. Change the whole line with:

<xsl:decimal-format name="European" decimal-separator="," grouping-separator="." minus-sign="-" NaN="error" />

2. Now, locate your <xsl:value-of select=”@Total”/> and replace it as follows:
<xsl:value-of select="format-number(@Total, "€#.###,00;-€#.###,00", "European")"/>