473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to stop page_load when pressing button?

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!

--
McGeeky
http://mcgeeky.blogspot.com

Nov 19 '05 #1
2 1588
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
"McGeeky" <an**@anon.com> wrote in message
news:Os**************@TK2MSFTNGP09.phx.gbl...
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!

--
McGeeky
http://mcgeeky.blogspot.com

Nov 19 '05 #2
Cool... thanks!!

--
McGeeky
http://mcgeeky.blogspot.com
"imperugo" <ug**********@dgsworld.it> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
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
"McGeeky" <an**@anon.com> wrote in message
news:Os**************@TK2MSFTNGP09.phx.gbl...
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!

--
McGeeky
http://mcgeeky.blogspot.com


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: thejackofall | last post by:
Hi. I have a button called btnSelect on a web form. There is a handler for it. However, the Page_Load() gets called before the handler gets called. I want to do the following. In the...
6
by: Denna | last post by:
Hello, I'm having a little trouble with cookies, I can write one when I press a button using the following code:- HttpCookie myCookie = new HttpCookie("MyTestCookie"); myCookie.Value =...
8
by: Matt Theule | last post by:
While stepping through an ASP.NET project, I found that data was being inserted into my database even though I was not stepping through the code that inserted the data. I have a single page with...
17
by: Arpan | last post by:
When a Button is clicked in a Web Form in an ASPX page, the Form will post back to itself. Under such circumstances (i.e. when a Button is clicked), will the Page_Load sub execute first & then will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.