i want check row(s) lather update, when if condition appears if not checked.
<asp:templatefield headertext="stock" itemstyle-width="72px" headerstyle-width="72px"> <itemtemplate> <asp:checkbox id="instockcbx" runat="server" /> </itemtemplate> </asp:templatefield> protected void usedforbutton_click(object sender, eventargs e) { foreach (gridviewrow row in gridview1.rows) { checkbox chkbox = row.findcontrol("instockcbx") checkbox; if (chkbox.checked) { int id = convert.toint32(gridview1.datakeys[row.rowindex].value.tostring()); conn.open(); sqlcommand comm = new sqlcommand("update worktable set instock = 0, usedorder = @usedorder id=@id", conn); comm.commandtype = commandtype.text; comm.parameters.add("@id", sqldbtype.int, 1).value = id; comm.parameters.add("@usedorder", sqldbtype.varchar).value = usedfortextbox.text; comm.executenonquery(); conn.close();
Comments
Post a Comment