Problem with update panel?
in my page contains user contact form inside of update panel..on first time when user submit the query it will stored in database without page refresh...when trying to submit one more details,the page get refreshed .The value does not inserted...that is my problem..can any one give me the reference.....

selva kumarPosted Oct 4, 2013, 8:34 AM
Sunny SharmaPosted Oct 4, 2013, 8:07 AM
-------------------------------------------
-------------------------------------------
HTH :)
selva kumarPosted Oct 4, 2013, 7:53 AM
here is my code..
C#:
public partial class contactnew : 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();
if (!IsPostBack)
{
Label2.Visible = false;
}
}
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();
Label2.Visible = true;
Label2.Text = "Your query has been submitted sucessfully.Admin will reach you soon.";
}
}
public void Clear()
{
txtname.Text = "";
txtmail.Text = "";
txtsubject.Text = "";
txtmessage.Text = "";
}
}
Sunny SharmaPosted Oct 4, 2013, 6:42 AM
You need to specify the trigger control inside
-------------------------------------------------------
-------------------------------------------------------
Also,I've created a sample app for demonstration purposes. Find it attached here and go through.
Happy Coding :)
selva kumarPosted Oct 4, 2013, 5:45 AM
Sanjeeb LenkaPosted Oct 4, 2013, 5:34 AM
write a trigger in update panel and pass the button id to it.
...