How to stop page_load when pressing button?

Discussion in 'ASP .Net' started by McGeeky, Sep 14, 2005.

  1. McGeeky

    McGeeky Guest

    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
    McGeeky, Sep 14, 2005
    #1
    1. Advertising

  2. McGeeky

    imperugo Guest

    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" <> wrote in message
    news:...
    >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
    >
    >
    >
    imperugo, Sep 14, 2005
    #2
    1. Advertising

  3. McGeeky

    McGeeky Guest

    Cool... thanks!!

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


    "imperugo" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >>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
    >>
    >>
    >>

    >
    >
    McGeeky, Sep 14, 2005
    #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. Philip Townsend

    button focus and pressing enter

    Philip Townsend, Aug 14, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    8,746
  2. bminder
    Replies:
    1
    Views:
    2,153
    nfedin
    Feb 23, 2004
  3. z. f.
    Replies:
    0
    Views:
    550
    z. f.
    Oct 19, 2004
  4. rockdale
    Replies:
    1
    Views:
    648
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
  5. albert kao
    Replies:
    1
    Views:
    2,000
    marisa lee
    Apr 10, 2010
Loading...

Share This Page