BIG question on datagrid

K

Kevin YU

hi all

I have a picky client who complain about the datagrid on one of my asp.net
project.

one of the column need to total at the bottom of the datagrid, so I have a
command
button there to press to get the sum, but I got an email today said that
should be done
automatically, no one want to press that sum button. ok, yes. it's just one
click, in windows
form, it's not even a question, but in asp.net datagrid, it might be a bit
challenging. I
wonder if anyone came across any problem like this, or is there any solution
to this?

this could be the weakness of the asp.net control, but I know it could be
done, but there
will be a lot of work .hope I am wrong.

cheers!

Kevin
 
K

Kevin YU

Ken

Thanks for your repsonse.
actually I have already done the sum by doing a round trip back to the
server.
BUT the client wants the totoal automatically done without a postback aka
pushing a sum total button.yes, it's only one click, but as you know nowaday
the users are spoiled by the better than better technology, the button
pushing
generation has been evolved into click-free no button pushing X-gen. aka
getting lazier and lazier. anyway, I don't that could be done with
javascript in asp
but with the datagrid dynamically generated row, I still can do that. just
need
to develope a custom datagrid control. so I wonder if anyone out there has
a same kind of user and get the problem solved.



Kevin
 
V

vMike

You can also add a row to you table with the calculated information using
dim myRow as DataRow
myrow = dt.NewRow()
myrow("Field1")=""
myrow("Field2")=""
..
..
..
myrow("TotalField")=val(valuevariable.tostring("##,##0.00")
dt.rows.add(myrow)

Where in this case dt is a datatable
 
V

vMike

Or better yet. Just add a label under the table with the calculated total.
Seems pretty straight forward.
 
K

Kevin YU

Thanks for your repsonse.
actually I have already done the sum by doing a round trip back to the
server.
BUT the client wants the totoal automatically done without a postback aka
pushing a sum total button.yes, it's only one click, but as you know nowaday
the users are spoiled by the better than better technology, the button
pushing
generation has been evolved into click-free no button pushing X-gen. aka
getting lazier and lazier. anyway, I don't that could be done with
javascript in asp
but with the datagrid dynamically generated row, I still can do that. just
need
to develope a custom datagrid control. so I wonder if anyone out there has
a same kind of user and get the problem solved.



Kevin
 
V

vMike

Can you do the sum before the table is rendered and send the total with the
render?. Or are you dealing with data changes by the user?
 
K

Kevin YU

ok. it's CLIENT side auto-sum by javascript, this is one of the function
that the out of the box datagrid control is missing.
and I think it's the weakness of the postback model.

what I mean is after the client's input, a total will be calculated on the
client side script. not posting back to the server, even
and auto postback is not acceptable and it's not efficient anyway.

Kevin
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top