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(); }
protected void btnSave_Click(object sender, EventArgs e) { Debug.WriteLine("Index"); DatabaseConnectivity dbcon = new DatabaseConnectivity(); string title = "Demo Title Manual"; string desc = "Demo desc Manual"; TextBox txtpatchNumber = DetailsView1.FindControl("txtPatchHotNumber") as TextBox; TextBox txtDeployedBy = DetailsView1.FindControl("txtPatchDeployedBy") as TextBox; TextBox txtCreatedDate = DetailsView1.FindControl("txtPatchCreatedDate") as TextBox; TextBox txtDeployedDate = DetailsView1.FindControl("txtPatchDeployedDate") as TextBox; TextBox txtStatus = DetailsView1.FindControl("txtPatchStatus") as TextBox; TextBox txtClient = DetailsView1.FindControl("lblClientName") as TextBox; int clientID = dbcon.getClientId(txtClient.Text); string patchNumber = txtpatchNumber.Text.ToString(); string deployedBy = txtDeployedBy.Text.ToString(); string createdDate = txtCreatedDate.Text.ToString(); string deployedDate = txtDeployedDate.Text.ToString(); string status = txtStatus.Text.ToString(); int productID = Convert.ToInt32(dropProduct.SelectedValue); int envType = Convert.ToInt32(dropEnvironment.SelectedValue); int res = dbcon.updatePatcheManually(title, desc, patchNumber, deployedBy, createdDate, deployedDate, status, clientID, productID, envType); DetailsView1.Visible = false; }