protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { //if (!Page.IsPostBack) //{ DatabaseConnectivity dbcon = new DatabaseConnectivity(); String ClientName = GridView1.DataKeys[e.RowIndex].Value.ToString(); int queryResult = dbcon.updateClientPatches2(dbcon.getClientId(ClientName), Convert.ToInt32(dropProduct.SelectedValue), Convert.ToInt32(dropEnvironment.SelectedValue)); //int userid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()); //GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; //Label lblID = (Label)row.FindControl("lblClientName"); ////TextBox txtname=(TextBox)gr.cell[].control[]; //TextBox textName = (TextBox)row.Cells[0].Controls[0]; //TextBox textadd = (TextBox)row.Cells[1].Controls[0]; //TextBox textc = (TextBox)row.Cells[2].Controls[0]; ////TextBox textadd = (TextBox)row.FindControl("txtadd"); ////TextBox textc = (TextBox)row.FindControl("txtc"); //GridView1.EditIndex = -1; Debug.WriteLine("Query Result: " + queryResult); //Debug.WriteLine(textName.Text + "\n" + textadd.Text + "\n" + textc.Text + "\n"); //conn.Open(); ////SqlCommand cmd = new SqlCommand("SELECT * FROM detail", conn); //SqlCommand cmd = new SqlCommand("update detail set name='" + textName.Text + "',address='" + textadd.Text + "',country='" + textc.Text + "'where id='" + userid + "'", conn); //cmd.ExecuteNonQuery(); //conn.Close(); //gvbind(); // } _BindService(); }