protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = (GridViewRow)GridView2.Rows[e.RowIndex]; int BookingRefNo=int.Parse(GridView2.DataKeys[e.RowIndex].Value.ToString()); string AssignedPriority = ((TextBox)row.Cells[11].Controls[0]).Text; string Status = ((TextBox)row.Cells[12].Controls[0]).Text; SqlConnection con1 = new SqlConnection(constr); SqlCommand cmd = new SqlCommand("Update TSafetyMaster set AssignedPriority=@AssignedPriority,Status=@Status where BookingRefNo=@BookingRefNo", con1); cmd.Parameters.Add("@BookingRefNo", SqlDbType.Int).Value = BookingRefNo; cmd.Parameters.Add("@AssignedPriority", SqlDbType.VarChar).Value = AssignedPriority; cmd.Parameters.Add("@Status", SqlDbType.NVarChar).Value = Status; con1.Open(); cmd.ExecuteNonQuery(); GridView2.EditIndex=-1; GridView2.DataBind(); }
DataSet
whenever you make changes to DATA in GridView control... reflect those changes to DataSet
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)