Please help me i do not want to show successfully message in again insertation in page.
protected void Button1_Click(object sender, EventArgs e)
{
try
{
string constr;
constr = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
con.Open();
string str = "insert into Doe_detail values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "')";
SqlCommand cmd = new SqlCommand(str, con);
cmd.ExecuteNonQuery();
con.Close();
Label2.Visible = true;
Label2.Text = "Data has Been Successfully inserted";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
}
catch (Exception es)
{
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
Label2.Visible = false;
}
}