c# code:
public partial class _Default : System.Web.UI.Page
{
SqlConnection Con;
SqlCommand Cmd;
protected void Page_Load(object sender, EventArgs e)
{
Con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=SS;Integrated Security=True");
Label1.Text = DateTime.Now.ToString();
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
Con.Open();
Cmd = new SqlCommand("Insert Into contactform Values('" + txtname.Text + "','" + txtmail.Text + "','" + txtsubject.Text + "','" + txtmessage.Text + "','"+Label1.Text+"')", Con);
Cmd.ExecuteNonQuery();
}
catch (Exception EX)
{
Response.Write("" + EX.ToString());
}
finally
{
Con.Close();
Clear();
popupextender1.Enabled = true;
popupextender1.Show();
}
}
public void Clear()
{
txtname.Text = "";
txtmail.Text = "";
txtsubject.Text = "";
txtmessage.Text = "";
}
}

TulasiPosted Oct 3, 2013, 5:33 AM
i copied the code in sample page , and it is working fine .
please upload the sample .
Thanks,
Tulasi