Print Page | Close Window

Calculation on DataItem...

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=9896
Printed Date: 29 March 2026 at 10:15am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Calculation on DataItem...
Posted By: MrCarl
Subject: Calculation on DataItem...
Date Posted: 17 February 2004 at 12:26pm

I need to basically perform a calculation on a DataItem and then display it as a Currency, I know how to do each bits individually but not together!! Can someone point me in the right Direction??

This is how I display things as a currency:

<%# DataBinder.Eval(Container.DataItem, "decAmount", "{0:c}") %>

and this is how I perform the calculation:

<%# Container.DataItem("decAmount") / 100 * 17.5 %>

How do I do both together??

Thanks

- Carl S




Replies:
Posted By: Mart
Date Posted: 17 February 2004 at 2:15pm

In your code:

Public Function ProcessData(intInput As Integer)

Return intInput / 100 * 17.5

End Function

In your design:

<%# ProcessData(DataBinder.Eval(Container.DataItem, "decAmount", "{0:c}")) %>




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net