protected void btnSave_Click(object sender, EventArgs e) { TextBox txtClientId = DetailsView1.FindControl("txtClientID") as TextBox; TextBox txtClientName = DetailsView1.FindControl("txtClientName") as TextBox; DropDownList txtClientType = DetailsView1.FindControl("dropClientType") as DropDownList; TextBox txtClientDesc = DetailsView1.FindControl("txtClientDesc") as TextBox; CheckBox chkClientStill = DetailsView1.FindControl("chkClientStill") as CheckBox; TextBox txtPOCName = DetailsView1.FindControl("txtPOCName") as TextBox; TextBox txtPOCEmail = DetailsView1.FindControl("txtPOCEmail") as TextBox; TextBox txtPOCPhone = DetailsView1.FindControl("txtPOCPhone") as TextBox; int ClientID = Convert.ToInt32(txtClientId.Text.ToString()); string ClientName = txtClientName.Text.ToString(); string ClientType = txtClientType.SelectedValue.ToString(); string ClientDesc = txtClientDesc.Text.ToString(); bool ClientStill = chkClientStill.Checked; string ClientPOC = txtPOCName.Text.ToString(); string ClientPOCEmail = txtPOCEmail.Text.ToString(); string ClientPOCPhone = txtPOCPhone.Text.ToString(); Debug.WriteLine(""); Debug.WriteLine("Data From Grid:"); Debug.WriteLine("ClientID: " + ClientID); Debug.WriteLine("ClientName: " + ClientName); Debug.WriteLine("ClientType: " + ClientType); Debug.WriteLine("ClientDesc: " + ClientDesc); Debug.WriteLine("ClientStill: " + ClientStill); Debug.WriteLine("ClientPOC: " + ClientPOC); Debug.WriteLine("ClientPOCEmail: " + ClientPOCEmail); Debug.WriteLine("ClientPOCPhone: " + ClientPOCPhone); DatabaseConnectivity dbcon = new DatabaseConnectivity(); int ResultQuery = dbcon.setAClient(ClientID, ClientName, ClientType, ClientDesc, ClientStill, ClientPOC, ClientPOCEmail, ClientPOCPhone); //Console.WriteLine("<script>alert(" + ResultQuery + "record has been updated." + ")</script>"); //ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToString(), "<script>alert(" + ResultQuery + "record has been updated." + ")</script>", true); //ScriptManager.RegisterStartupScript(this, this.GetType(), DateTime.Now.ToString(), "<script>alert(" + ResultQuery +")</script>", true); DetailsView1.Visible = false; //DetailsView1.Style.Add("display", "none"); }