Calculate difference in fields when user inputs
Posted on 2008-09-29
I have 6 fields as follows on a ASP.net datagridview as follows.
The fields are for entering the number of days in two periods, say called X & Y or to calculate the difference in the two period - the user needs both options.
1) Number of Days X
2) Number of Days Y
3) Start Date X
4) End Date X
5) Start Date Y
6) End Date Y
The user can enter "Number of X" & "Number of Y"
or choose a start and end date and have fields 1) & 2) calculated automatically.
Fields 3-6 give ajax popup calendars.
IF the user chooses a start and end date in fields 3) & 4), field 1) should be calculated as field 4)-field 3)
IF the user chooses a start and end date in fields 5) & 6), field 2) should be calculated as field 6)-field 5)
I'm stuck at how to trigger the calcs of field 1) & field 2) when user makes change to fields 3-6.
The number of rows can change when user clicks on an "Add" button. This is an inmemory dataset, it is not linked to a database.
Thanks in advance for code to solve this problem.