After Page_Load

Discussion in 'ASP .Net' started by =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=, Aug 18, 2005.

  1. I would like to know how to catch the code after the end of the Page_Load
    event. I found something not to my expection after the Page_Load. It is
    when I hit the ENTER key when it post back. It goes to Page_Load, when it
    reaches the end of the event, I could not trace any more. I don't know where
    it goes. Can you tell me how do I catch what happening after it?
    =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=, Aug 18, 2005
    #1
    1. Advertising

  2. ASP.NET Page Life Cycle

    http://www.15seconds.com/issue/020102.htm

    --
    Robbe Morris - 2004/2005 Microsoft MVP C#

    Earn money answering .NET Framework
    messageboard posts at EggHeadCafe.com.
    http://www.eggheadcafe.com/forums/merit.asp



    "Steve Wonderful" <> wrote in
    message news:...
    >I would like to know how to catch the code after the end of the Page_Load
    > event. I found something not to my expection after the Page_Load. It is
    > when I hit the ENTER key when it post back. It goes to Page_Load, when it
    > reaches the end of the event, I could not trace any more. I don't know
    > where
    > it goes. Can you tell me how do I catch what happening after it?
    Robbe Morris [C# MVP], Aug 18, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=

    jasonkester Guest

    You can't trace past the end of the page_load because you don't have
    any events firing, and thus all server-side is finished as far as you
    are concerned. You'll notice the same thing if you step through the
    page the first time it is requested.

    It looks like you're trying to figure out a way to handle a vanilla
    form submit event, where none of the built-in ASP.NET handlers have
    been hooked up. You can do this by inspecting the Request.Form
    collection for evidence of any events that have been requested. If
    none are found, you'll know you're about to fall off the end of the
    Page LifeCycle and can take action:

    if (!IsPostBack)
    {
    // you'll probably have some Population code here...
    }
    else
    {
    if (Request.Form["YourSubmitButton"] == null &&
    Request.Form["__EVENTTARGET"] == null)
    {
    // Not firing any events, and don't see a reference to the Submit
    button,
    // so the user probably hit Enter to post the form.

    // Handle it here...
    }

    }


    Good luck!

    Jason Kester
    Expat Software Consulting Services
    http://www.expatsoftware.com/
    jasonkester, Aug 18, 2005
    #3
  4. Thank you all.

    "jasonkester" wrote:

    > You can't trace past the end of the page_load because you don't have
    > any events firing, and thus all server-side is finished as far as you
    > are concerned. You'll notice the same thing if you step through the
    > page the first time it is requested.
    >
    > It looks like you're trying to figure out a way to handle a vanilla
    > form submit event, where none of the built-in ASP.NET handlers have
    > been hooked up. You can do this by inspecting the Request.Form
    > collection for evidence of any events that have been requested. If
    > none are found, you'll know you're about to fall off the end of the
    > Page LifeCycle and can take action:
    >
    > if (!IsPostBack)
    > {
    > // you'll probably have some Population code here...
    > }
    > else
    > {
    > if (Request.Form["YourSubmitButton"] == null &&
    > Request.Form["__EVENTTARGET"] == null)
    > {
    > // Not firing any events, and don't see a reference to the Submit
    > button,
    > // so the user probably hit Enter to post the form.
    >
    > // Handle it here...
    > }
    >
    > }
    >
    >
    > Good luck!
    >
    > Jason Kester
    > Expat Software Consulting Services
    > http://www.expatsoftware.com/
    >
    >
    =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=, Aug 18, 2005
    #4
    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. bminder
    Replies:
    1
    Views:
    2,151
    nfedin
    Feb 23, 2004
  2. mortb
    Replies:
    0
    Views:
    757
    mortb
    May 4, 2004
  3. z. f.
    Replies:
    0
    Views:
    549
    z. f.
    Oct 19, 2004
  4. =?Utf-8?B?YW1pcm1pcmE=?=
    Replies:
    1
    Views:
    1,507
    =?Utf-8?B?YW1pcm1pcmE=?=
    Apr 5, 2005
  5. rockdale
    Replies:
    1
    Views:
    647
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
Loading...

Share This Page