DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 20 Aug 2007 18:23:09 -0400,    posted on: microsoft.public.dotnet.framework.adonet        back       

Thread Index
  1    Nathan Sokalski


Inline Calculations for Databinding   
I have two fields in the Datatable that I am using as my DataSource that I 
need to multiply together before displaying them. Here is the databinding 
expressions from my ASPX file to display the fields separately:

'<%# Databinder.Eval(Container.DataItem,"price","{0:C}") %>'
'<%# Databinder.Eval(Container.DataItem,"quantity","{0:D}") %>'

These are obviously both numeric values, but because my DataTable is not 
created from a database, I cannot add an extra field by modifying my SQL 
statement. Is there a way to somehow include an expression in the 
databinding expression that multiplies the two values together? The only 
alternative that I can think of is to use the ItemDataBound event and 
manually assign the product of the two values to the desired control, but 
because this requires using CType and FindControl, it is rather inefficient. 
Any other ideas? Thanks.
-- 
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
Date:Mon, 20 Aug 2007 18:23:09 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us