Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have grid in update panel it has amount column.. in that 'n' rows i want total of all amount column on keypress and display it in txtTotalAmt,for each insertion of amount in amount column it has to add total in txtTotalAmt
Posted

you can use java script for key press event..

or u can use textbox text changed event of gridview.

for that u need to bind event handler in row bound event
 
Share this answer
 
Comments
deepu8182 21-Jul-12 6:06am    
How to bind gridview in javascript on keypress event without webservice.
Hi Kiirrii

Try this code:-
C#
private void DataGridView1_KeyPress(object sender, KeyPressEventArgs e)
     {
       foreach(DataGridViewRow row in DataGridView1.Rows)
        {
          txtTotalAmt.Text = Convert.ToString(Convert.ToDouble(txtTotAmount.Text)+
                             Convert.ToDouble(row.Cells["amount"].value))
        }
     }


Hope this work !!
 
Share this answer
 
Comments
Sandeep Mewara 8-May-12 8:48am    
OP tagged the question as ASP.NET
Kiirrii 9-May-12 5:37am    
for grid there is no keypress or up event we have to use keyup for textbox inside grid how to use that one

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