After Page_Load

G

Guest

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?
 
J

jasonkester

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/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top