page_load fires two times

Discussion in 'ASP .Net' started by Arjen Hoekstra, Jul 23, 2004.

  1. 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
    Arjen Hoekstra, Jul 23, 2004
    #1
    1. Advertising

  2. Arjen Hoekstra

    Shiva Guest

    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
    Shiva, Jul 23, 2004
    #2
    1. Advertising

  3. 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
    >
    >
    >
    Arjen Hoekstra, Jul 23, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. H Branyan

    Page_Load fires twice

    H Branyan, Oct 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    668
    H Branyan
    Oct 22, 2003
  2. Jon
    Replies:
    1
    Views:
    11,326
    George Ter-Saakov
    Jan 13, 2004
  3. Jay Douglas
    Replies:
    7
    Views:
    590
  4. Jeffrey Ah-Chong

    Page_Load event fires multiple times?

    Jeffrey Ah-Chong, Jul 14, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    643
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Jul 14, 2006
  5. Replies:
    3
    Views:
    980
Loading...

Share This Page