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.....


Sanjeeb LenkaRank #301 · 8.3K reputationPosted Oct 4, 2013, 1:34 AM EDT
write a trigger in update panel and pass the button id to it.
...
selva kumarRank #2,987 · 483 reputationPosted Oct 4, 2013, 1:45 AM EDT
Sunny SharmaRank #223 · 11.1K reputationPosted Oct 4, 2013, 2:42 AM EDT
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 kumarRank #2,987 · 483 reputationPosted Oct 4, 2013, 3:53 AM EDT
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 SharmaRank #223 · 11.1K reputationPosted Oct 4, 2013, 4:07 AM EDT
-------------------------------------------
-------------------------------------------
HTH :)
selva kumarRank #2,987 · 483 reputationPosted Oct 4, 2013, 4:34 AM EDT