protected void Button1_Click(object sender, EventArgs e) { ContactUsClass contactus = new ContactUsClass(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text); string result = ConnectionClass.AddEnquiry(contactus); Label1.Visible = true; Label1.ForeColor = System.Drawing.Color.Red; Label1.Text = result; try { SendMail(); } catch (Exception) { } if (Label1.Text == "Enquiry Added Successfully") { TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; } }