A formula field for datalists? Bad Idea?

R

Roy

Ok, here's my problem and I'm a first year webbie, so you'll have to
bear with me. I'm converting some Access reports over to a .NET
website. It's your typical Access cluster$#@$ (pardon my French). The
report is essentially a single row with 10 columns. Each column holds
data mostly independent of the other columns as shown here:

col1 --data is pulled from table "x"
col2 --data is pulled from table "y"
col3 --data is pulled from table "epsilon"

So when I was assigned this, I immediately thought of having a datalist
for each "column" and arranging them to look like a row. No problem.
However, a couple of the columns are formula fields that calculate the
difference between certain columns.

What's the best way to go about creating these "formula fields?" Use a
datalist and populate it in the code-behind? Use a label? Or is there
some other method I'm not considering?

Thanks!
 
F

Frankie

If my answer is totally off track - which it could be - then please clarify
what you need help with. What do you mean by [creating these formula
fields]. Are you wondering how to render the results of the calculation on
the page? or how/where to actually perform the calculations?

If it's regarding the specific control in which to display the value - then
sure a Label would work, or a Literal or whatever.

Any calculations should typically be done somewhere prior to the data
getting loaded into your DataList (or whatever meany you plan to display the
data on the rendered page). At some point you have to pull the data out of
the database (or whatever data source you are using). That would be your
first opportunity to do the calculations (e.g., right in the SQL or stored
procedure). Your next opportunity would be in some middle layer class - if
you have one. The last place to do this sort of thing would be in your UI
layer (i.e., your aspx code-behind logic).


-HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top