Hi,
Within a datagrid I have a value that is a currency value within a shopping cart page. This value takes the individual amount of the item and multiplies the quantity value to give the sub total. However I want to add a "£" sign before the value i.e. Not 30.00 BUT £30.00.
Now I know you can use the code dataformatstring="£{0:F2}" when using a boundcolumn within a datagrid but how about when using an item template ? Sample code below written in asp.net 1.1 and vb2003 - thanks :
Code:
<asp:TemplateColumn HeaderText="Amount">
<HeaderStyle horizontalalign="Center"></HeaderStyle>
<ItemStyle horizontalalign="Center"></ItemStyle>
<ItemTemplate>
<%# FormatNumber(GetAmount(Container.DataItem("curSalePrice"), Container.DataItem("intQuantityOrder"))) %>
</ItemTemplate>
</asp:TemplateColumn>
...
Function GetAmount(curSalePrice As Decimal, intQuantity As Decimal)
Amount = curSalePrice * intQuantity
Total =+ Amount
Return Amount
End Function
Function GetTotal()
Return Total
End Function