0

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;
    }
}
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by sufyan2011
0

You can do it with help of javascript. On client side "onclick" event of all Textboxes (1 to 5), call the javascript function to hide message label. Try to write the code, if there is some problem, we will help you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.