protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Update") { int RowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow row = (GridViewRow)GridViewDept.Rows[RowIndex]; Label deptno = (Label)row.FindControl("lblDeptNO" ); TextBox deptname = (TextBox)row.FindControl("txtDeptName"); TextBox deptloc = (TextBox)row.FindControl("txtloc"); cn.Open(); string query = "update dept set dname'" + deptname.Text + "','" + deptloc.Text + "' where deptno='" + deptno.Text + "'"; cm = new SqlCommand(query, cn); cm.ExecuteNonQuery(); cn.Close(); ShowRecords(); } protected void GridViewDept_RowEditing(object sender, GridViewEditEventArgs e) { GridViewDept.EditIndex = e.NewEditIndex; GridViewDept.FindControl("txtDeptNO").Visible = true; GridViewDept.FindControl("txtDeptName").Visible = true; GridViewDept.FindControl("txtloc").Visible = true; ShowRecords(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)