Solved

How can I determine the event that caused a Page_Load?

Posted on 2006-07-03
4
663 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
  • 2
4 Comments
 
LVL 17

Expert Comment

by:lem2802
Comment Utility
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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now