On Feb 16, 11:57 am, Robert Chapman
<RobertChap...@discussions.microsoft.comwrote:
Hi Alexey,
I've seen that thread and am comfortable with using javascript to add a
running total for specific textboxes. I get less sure of what to do when
there are 50 columns to total and the number of rows is variable. What works
well for one total doesn't really work for 50, so I just need a little
guidance as to what route to take.
If I understand it right it might be following
in codebehind you will add onchanged JS with reference to some JS to
recalculate total
In the same time you can calculate the current total, number of rows,
etc. and set it to a public variable, which can be used later in
client side JS.
-- javascript --
var numberOfRows=<%=numberOfRows%>
.....
Depends on implementation, if you have a maximum possible number of
rows (say <25) you may not need to have the numberOfRows because you
can enumerate your rows like
for (var i=1;i<25;i++) {
if (mytextbox == null) {
return; // if you have a null between 1..25 it means you have less
rows
} else {
total += mytextbox.value;
}
}
I think that you need a similar solution, as in the following thread:
http://groups.google.com/group/micro...adfd47b1745c36