c# - Removing Uncheck values on datagrid -
i want remove values have unchecked on data grid cancel button.i know how checked ones how can in unchecked rows?
here code checkeded button proceed
foreach (gridviewrow row in gridview1.rows) { checkbox chkrow = (row.cells[0].findcontrol("chkrow") checkbox); if (chkrow.checked) { con.open(); cmd = new sqlcommand(@"update jobquotations1 set transactionstatus = @done transactionid = @tid , transactionnum = @num", con); cmd.parameters.addwithvalue("@done", "done"); cmd.parameters.addwithvalue("@tid", row.cells[2].text); cmd.parameters.addwithvalue("@num", row.cells[4].text); cmd.executenonquery(); con.close(); loaddatagrid(); } }
i added 1 (!chkrow.checked)
on if statment , worked me.
` foreach (gridviewrow row in gridview1.rows) { checkbox chkrow = (row.cells[0].findcontrol("chkrow") checkbox); if (!chkrow.checked) { con.open(); cmd = new sqlcommand(@"update jobquotations1 set transactionstatus = @cancel transactionid = @tid , transactionnum = @num", con); cmd.parameters.addwithvalue("@cancel", "cancel"); cmd.parameters.addwithvalue("@tid", row.cells[2].text); cmd.parameters.addwithvalue("@num", row.cells[4].text); cmd.executenonquery(); con.close(); loaddatagrid(); } }`