473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

After Page_Load

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?
Nov 19 '05 #1
3 1839
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" <St************@discussions.microsoft.com> wrote in
message news:C6**********************************@microsof t.com...
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?

Nov 19 '05 #2
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/

Nov 19 '05 #3
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/

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
1
by: Stanley | last post by:
I am working with Exceptions and have found a bit of a problem for me. Using the code below in Debug I get the info I want which is basically: -Line of error -Column of error -Method where error...
1
by: dhornyak | last post by:
I have been banging my head against the wall for a while now, and can't seem to id the problem. I've been through a ton of posts and the code doesn't seem any different. Can anybody see it? When...
8
by: CDARS | last post by:
Hi all, I have a confusing question on ASP.NET cookies usage: 1> Response.Cookies("test").value = Now 2> Response.Write(Request.Cookies("test").value) 3> 4> Response.write("<hr>") 5>...
1
by: Michal Kostic via .NET 247 | last post by:
Hi I am encountering following ASP.NET problem: In the Page_Load event I initialize connection string of a sqlconnection. This works fine most of the time, but when the usercontinues using the...
2
by: John Dalberg | last post by:
I need to know what happens after Page_load has finished so I put a breakpoint at the last statement. However after stepping into after this last statement, the app continues running without the...
1
by: rockdale | last post by:
Hi, I have a masterpage and on the page_load event I Populate my mainmenu from database. I the page_load event of my content, I am trying to programmly select the menuitem that represent...
3
by: ronchese | last post by:
Hello. I wrote a Web Custom Control that have a property named SelectedValue. This SelectedValue property is set after the user clicks a LinkButton control, by its Click() event. I did some...
7
by: jphaycock | last post by:
Hi all I am calling a method in a Page_Load event that makes use of a value from a text box. Unfortunately the textbox value is only set after a javascript runs and the page is rendered....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.