Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > page_load fires two times

Reply
Thread Tools

page_load fires two times

 
 
Arjen Hoekstra
Guest
Posts: n/a
 
      07-23-2004
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


 
Reply With Quote
 
 
 
 
Shiva
Guest
Posts: n/a
 
      07-23-2004
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" <> wrote in message
news:cdqn2o$q4$...
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



 
Reply With Quote
 
 
 
 
Arjen Hoekstra
Guest
Posts: n/a
 
      07-23-2004
Thanks! That did the trick.

Arjen
"Shiva" <> schreef in bericht
news:...
> 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" <> wrote in message
> news:cdqn2o$q4$...
> 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
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple composite control fires event fires first time but not second sellars.paul@googlemail.com ASP .Net Web Controls 3 05-13-2009 03:19 PM
Page_Load event fires multiple times? Jeffrey Ah-Chong ASP .Net 1 07-14-2006 01:37 PM
Page_Load Event Fires Twice When Sending Down a PDF Jay Douglas ASP .Net 7 01-10-2005 05:05 PM
Page_Load event fires twice in asp.net (C#) ? Jon ASP .Net 1 01-13-2004 02:49 PM
Page_Load fires twice H Branyan ASP .Net 0 10-22-2003 09:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57