Click here to Skip to main content
15,885,716 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I will have a gridview with checkboxes and some amount fields. I would like to display the sum of the amount in gridview footer depending on the checked items by the user. Can any one give me a sample code
Posted

For goodness sake learn to use a search engine.

I just tried using your question and got loads and loads of hits.
 
Share this answer
 
Comments
demouser743 20-Sep-10 11:01am    
I tried but doesn't get the appropriate. I just found the normal way to display in the footer but i did not find the required i asked. Can you please post me the link for my exact one
Sandeep Mewara 20-Sep-10 11:04am    
For OP: What about taking leads from the normal way and try to code yourself?
Why is it that always *exact* code is needed?

[Updated: Added 'For OP' at the start of comment.]
demouser743 20-Sep-10 11:07am    
I am not asking for exact code actually my problem is as i am having list of check boxes inside the gridview for each and every checked event i have to do my validation and should display the total in the footer. So i am asking a sample code
Sandeep Mewara 20-Sep-10 11:12am    
Yes :)
I just followed up/added that to your answer. It was my response based on his comment to your answer.
No exact code!

Use Gridview RowDataBound (or DataGrid's ItemDataBound) event. In it, check the checkbox value and based on it keep track of total. At the end, use this total and display where ever needed.

Try!
 
Share this answer
 
Comments
demouser743 20-Sep-10 11:12am    
Ok but if i have sum n number of check boxes let us suppose some 100 if i select some 50 or above for each and every event postback will occur and this will not be good i think so
Sandeep Mewara 20-Sep-10 11:16am    
Thats new to question! If you want to have a runtime total then why do you want to have a postback? Why not do this on client side using Javascript?
demouser743 20-Sep-10 11:19am    
Ok

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900