How to stop page_load when pressing button?

  • Thread starter Thread starter McGeeky
  • Start date Start date
M

McGeeky

I use page_load to call a stored procedure and populate the form. When the
user clicks the OK button on the form I have implemented an event handler
behind it (OKButton_Click()) that calls another stored procedure to insert a
record in the database then navigate to a success page.

However, when the OKButton_Click() is called the page_load event is also
called. This unnescessarilly sets up the page again. How can I stop
page_load event being called when the user clicks the OK button?

Thanks!
 
put the code that it call the stored procedure in this condition

if(!Page.IsPostBack)
{
//....your code
}

with this condition the code is called only the first load
sorry for my english

byez
imperugo (exCartman)
myblog : http://imperugo.blogspot.com
 
Back
Top