N
Nathan Sokalski
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}") %>'
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.
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}") %>'
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.