Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 22nd, 2006, 07:55 AM
Authorized User
 
Join Date: Sep 2006
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default Item Template Query

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











Similar Threads
Thread Thread Starter Forum Replies Last Post
Export query param from Access form 2 XLS template gfranco Access VBA 0 April 14th, 2008 03:19 PM
Datagrid Item Template question dparsons ASP.NET 1.0 and 1.1 Professional 3 March 14th, 2007 09:08 AM
edit item template in a datagrid akshay144 ASP.NET 1.0 and 1.1 Professional 0 October 25th, 2006 05:05 AM
referencing an object in an edit item template dan195 ASP.NET 1.0 and 1.1 Basics 3 September 25th, 2006 07:15 AM
Tab item display prob / hide TABS query socoolbrewster CSS Cascading Style Sheets 4 June 13th, 2006 12:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.