2
Answers

addition operation in DataGridview using checkbox?

Hi,
I have one DataGridView(DGV) in my WindowsForm Application.My DGV Consists of 4 columns with one CheckBox field column.The column names are Select(For CheckBox Field),Test Name,Commission,Cost.Here my purpose is I want check CheckBox and insert some commission value into the commission cell by double click within the Commission cell.When I selecting multiple cell values the commission should be added by next cell commission value,Likewise cost also incremented by selecting multiple selected values using CheckBox.
The total Commission and cost should be displayed in two TextBoxes outside of DGV.I am unable to find how to write code for this and which event I have to write.
Thanks in advance.

Answers (2)

1
Photo of Ravi Patel
NA 7.8k 532.7k 8y
Hi ,
check the update method of this url
http://www.c-sharpcorner.com/UploadFile/0c1bb2/insert-update-delete-in-gridview-using-single-stored-proce/
tryto get the firstname by this way (TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString();
Accepted
1
Photo of Ashwanikumar singh
NA 37 3.4k 8y
(TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString();
This worked for me thanks
0
Photo of Vinay Singh
NA 5.9k 126.2k 8y
Hi Please check the code
TextBox txtfName= (TextBox)e.Row.FindControl("txtFirstName");
stringfirstname =txtfName.Text;
and check the link also
http://stackoverflow.com/questions/6873973/how-to-find-control-in-templatefield-of-gridview