# Super Duper Problem

Discussion in 'ASP .Net Web Controls' started by NKaufman, Jul 18, 2007.

1. ### NKaufmanGuest

Hello,

I need to see if we can create control that will do the following:

I have a company A with divisions B, C, D and E (these could grow in
future). Each of these divisions has subdivisions B1, B2...Bn, C1..Cn,
D1..Dn etc.

Now I need to create a page that displays the sales revenue, expenses,
profit/loss at each level. So the first time user comes to page, he
sees a box that contains numbers for company A (could be in a grid
format). When user clicks a + sign attached to this table, the table
expands and he sees the numbers for lower level divisions B,C, D, E
(each of these are in a different grid but on the same row). Now if I
click expand on any of these divisions, the lower level subdivisions
B1....Bn, C1..Cn, D1..Dn etc appear. If a user makes changes to the
numbers at any of the subdivisions, that change should be reflected
all the way to the top.

So let's say that company A has sales of \$1000, expenses of \$800 and
profit of \$200. SubDivision B1 has 50, 20 and 5 as its corresponding
data. So if I do not change any data in other subdivisions but change
B1 to be 60, 30 and 10, then my numbers at A should also reflect that
increase. and should be \$1010, 810, 205 respectively.

Further, I need to add a feature (what-if scenarios) whereby I could
drag a subdivision B1 (for example) and drop it to division C. Numbers
would now need to change throughout the structure to reflect the
possible changes of that action.

Any ideas/suggestions on how to implement this will be greatly
appreciated.

One idea I thought of is to cache all the numbers in a datatable;
create a user control (implement draggable interface and with a grid)
at each level and add to a placeholder control. Now each time a user
makes a change, I will update the cached datatable with data from
grids on the page(I will keep an ID field for each row in different
grids in different user controls) and then rebind the data.

Now if user drags and drops a user control to another I will update
cached datatable to reflect new parent for each row and then rebind
page to redraw the whole thing. But this seems very expensive.

Thanks a bunch

NKaufman, Jul 18, 2007