I'm fairly new to C#. I’ve recently embarked on a web project using asp.net Visual Web Developer. I'm having some issues with the commands for running calculations on a number of web forms.

Some of the web form consist 10 or more numerical fields.

Each form has a Total field.

There are fields that will need to be cross reference different tables to get the correct figure.

For example:

Table A Table B Table C Table D
--------------------------------------------------
Field A1 Field B1 Field C1 Field A1
Field A2 Field B2 Field C2 Field B2
Field A3 Field B3 Field C3 Field C3
--------------------------------------------------
Total A Total B Total C Total D

If someone could help me out on this one, I would be truly grateful

Recommended Answers

All 4 Replies

A bit confused. Correct me if im wrong..
You have multiple tables on the page. example:
TableA (3 rows 3 cols)
TableB (4 rows 3 cols)
TableC (3 rows 5 cols).
.
.
etc..

All containing some numbers, and you want to sum up all the numbers in each table and display the total of each table in the end?

My next question would be, are you using a gridView control for these tables, or its a normal html table?

Sorry about that post, what is should read is each "Form" not "Table".

The forms are on different pages

Form A Form B Form C Form D
--------------------------------------------------
Field A1 Field B1 Field C1 Field A1
Field A2 Field B2 Field C2 Field B2
Field A3 Field B3 Field C3 Field C3
--------------------------------------------------
Total A Total B Total C Total D

Sorry about that post, what is should read is each "Form" not "Table".

The web forms are on different pages. In the Example below each form has three fields. I need to be able to calculate the total value of each form. Form D refers to fields in the same solution, which needs to be calculated together.

Form A Form B Form C Form D
--------------------------------------------------
Field A1 Field B1 Field C1 Field A1
Field A2 Field B2 Field C2 Field B2
Field A3 Field B3 Field C3 Field C3
--------------------------------------------------
Total A Total B Total C Total D

I've attached the code in the affordabilty.aspx.cs file ( in the example, this would be Form D).
You will notice that there are various fields listed.
The main fields from this form that will come from other pages are fields that have Gross or Net Income (Form A), and any fields that have "outgoing" will also come from a different form (Form B).

What I'm looking for is a solution on how to call data from different web form that has been stored in a database (to repopulate a field that maybe set read only); also how to calculate the values entered in a web form to get a sum to be populated in a field called Total.

If the data in different web forms are populated from the database, i dont think you can retrieve the data from the web forms. The data on the forms will be populated only when the forms are loaded.

You will have to load all the data from the database in the current form and find the totals. The data doesn't need to be displayed on the form if its not required.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.