473,387 Members | 1,582 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.

page_load fires two times

Hello,

I've an ASP.NET-page in which there are some fields with data from a
database and an OK-button. When the page loads (so this code is in the
Page_Load-part) some data is send to the database (with MySql
'INSERT'-statement). But when I click the OK-button I see the same data is
being resend to the database. So Page_Load is fired again while it
shouldn't! Any-one knows how this could be happening? Thanks in advance for
any help!

Arjen
Nov 18 '05 #1
2 1415
Hi,

Page_Load will fire even on post-back (that is, when you click OK button).
Use Page.IsPostBack property to check whether the current execution is
because of post back or initial load and do things accordingly.

HTH.

"Arjen Hoekstra" <a.**********@student.utwente.nl> wrote in message
news:cd*********@netlx020.civ.utwente.nl...
Hello,

I've an ASP.NET-page in which there are some fields with data from a
database and an OK-button. When the page loads (so this code is in the
Page_Load-part) some data is send to the database (with MySql
'INSERT'-statement). But when I click the OK-button I see the same data is
being resend to the database. So Page_Load is fired again while it
shouldn't! Any-one knows how this could be happening? Thanks in advance for
any help!

Arjen

Nov 18 '05 #2
Thanks! That did the trick.

Arjen
"Shiva" <sh******@online.excite.com> schreef in bericht
news:OC**************@TK2MSFTNGP09.phx.gbl...
Hi,

Page_Load will fire even on post-back (that is, when you click OK button).
Use Page.IsPostBack property to check whether the current execution is
because of post back or initial load and do things accordingly.

HTH.

"Arjen Hoekstra" <a.**********@student.utwente.nl> wrote in message
news:cd*********@netlx020.civ.utwente.nl...
Hello,

I've an ASP.NET-page in which there are some fields with data from a
database and an OK-button. When the page loads (so this code is in the
Page_Load-part) some data is send to the database (with MySql
'INSERT'-statement). But when I click the OK-button I see the same data is
being resend to the database. So Page_Load is fired again while it
shouldn't! Any-one knows how this could be happening? Thanks in advance for any help!

Arjen

Nov 18 '05 #3

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

Similar topics

7
by: Jay Douglas | last post by:
Hello all, I have a asp.net page that creates a pdf on the fly and sends the pdf down to the browser. When calling the page up in IE the Page_Load event is fried twice. This doesn't happen with...
14
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
3
by: doobdave | last post by:
Hi all, I'm experiencing a rather strange problem: I am coding a web application using VB.net ASP.net and Visual Studio 2003. It's quite a large application, but the problem only occurs on...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
0
by: pat.allan | last post by:
Hi All This seems to be a common problem here, but I've not found a solution yet to fix it for me. When I request a page through a browser, the page_load fires once. When I request the page's...
12
by: Nathan Sokalski | last post by:
What is the difference between the Page_Init and Page_Load events? When I was debugging my code, they both seemed to get triggered on every postback. I am assuming that there is some difference,...
6
by: dwclark | last post by:
I am having an issue when I trigger a Response.Redirect, the Page_Load fires on the page where the Response.Redirect was called. From what I've read, this should not happen and the browser should...
1
by: choukrou | last post by:
Hello everybody! Got a nice problem on 1 of my aspx (and only one): It was working "perfectly" for 1year and a half. Last week I had to fix a lil bug. I do that and test my app. And on the fixed...
1
by: =?Utf-8?B?TWlrZXkgQmFieQ==?= | last post by:
Greetings Hopefully, I can be clear and concise on this one, but I'm confused. I have a page with a ListBox <- ODS <- BusinessObject and a button. The Parameter Source is 'None'. The Default...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.