How to stop page_load when pressing button?

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!
 
I

imperugo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top