protected void AddNewCustomer(object sender, EventArgs e) { Control control = null; if (GridView1.FooterRow != null) { control = GridView1.FooterRow; } else { control = GridView1.Controls[0].Controls[0]; } string SlNo = (control.FindControl("txtSlNo") as TextBox).Text; string Code = (control.FindControl("txtcode") as TextBox).Text; string details = (control.FindControl("txtdetails") as TextBox).Text; using (SqlConnection con = new SqlConnection("")) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO [Qtattemp] VALUES(@Code,@details,@SlNo)"; cmd.Parameters.AddWithValue("@SlNo", SlNo); cmd.Parameters.AddWithValue("@Code", Code); cmd.Parameters.AddWithValue("@details", details); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } } Response.Redirect(Request.Url.AbsoluteUri); }
Response.Redirect(Request.Url.AbsoluteUri);// This line reloading the whole page.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)