?
Solved

How can I determine the event that caused a Page_Load?

Posted on 2006-07-03
4
Medium Priority
?
678 Views
Last Modified: 2008-01-09
When an event triggers a postback, I normally see a Page_Load occur before the event handler is called.

Is there any way WITHIN the Page_Load handler for me to tell which event triggered the postback?
0
Comment
Question by:Jens Fiederer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 18

Expert Comment

by:Elvio Lujan
ID: 17031361
you can know it setting a flag in all objects events and in the page_prerender you'll get the value
0
 
LVL 23

Author Comment

by:Jens Fiederer
ID: 17033147
page_prerender is not Page_Load.

Are you trying to say there is no way to tell IN Page_Load?

And what do you mean by "setting a flag in all objects events"?
0
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 2000 total points
ID: 17035585
jensfiederer ,
Request.Form("__EVENTTARGET") will return the name of the control that caused the postback. Based on the retrieved control name, you'll know which event triggered the postback as well.
0
 
LVL 23

Author Comment

by:Jens Fiederer
ID: 17041881
That was useful, x_com.

Not quite what I asked for: there must be situations where more than one type of event causes postback for a control, and also this does not always work (I get a blank when pushing the button).

But it is quite likely that what I asked for does not exist, and in my situation this solves my problem splendidly!  So I am happy!

Note for when this is PAQed:  the "name of the control" is not the .NET name but the HTML form name.  So when a radiobuttonlist gets clicked, you will see selOperation_0 or selOperation_1, not selOperation.

Thank you!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question