473,320 Members | 1,829 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,320 software developers and data experts.

Find the action trigger at Page_Load

Hi,

Does anyone know how can I find what was the action trigger (button
pressed) at Page_Load? Because the Page_Load method is called first
everytime anything is posted to the server, I need to know what button
was pressed before performing anything in the Page_Load method. Is it
possible?

Thanks,
Jerry

Jun 4 '07 #1
3 1702
On Jun 4, 11:59 am, jerryau <jerrya...@gmail.comwrote:
Hi,

Does anyone know how can I find what was the action trigger (button
pressed) at Page_Load? Because the Page_Load method is called first
everytime anything is posted to the server, I need to know what button
was pressed before performing anything in the Page_Load method. Is it
possible?

Thanks,
Jerry
This will tell you the ID of the control:
string controlId = Page.Request.Form["__EVENTTARGET"];

Though I don't think that is documented behaviour, it's how ASP
manages control events under the hood, so could change in future
versions of ASP.

Jun 4 '07 #2
Jerry,
This question really belongs in the ASP.NET group, since it's about asp.net
page stuff and not really about the C# language specifically.

This article may help:

http://www.eggheadcafe.com/articles/20050609.asp

Peter

Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"jerryau" wrote:
Hi,

Does anyone know how can I find what was the action trigger (button
pressed) at Page_Load? Because the Page_Load method is called first
everytime anything is posted to the server, I need to know what button
was pressed before performing anything in the Page_Load method. Is it
possible?

Thanks,
Jerry

Jun 4 '07 #3
On Jun 4, 1:21 pm, Terry Rogers <rogers.te...@gmail.comwrote:
On Jun 4, 11:59 am, jerryau <jerrya...@gmail.comwrote:
Hi,
Does anyone know how can I find what was the action trigger (button
pressed) at Page_Load? Because the Page_Load method is called first
everytime anything is posted to the server, I need to know what button
was pressed before performing anything in the Page_Load method. Is it
possible?
Thanks,
Jerry

This will tell you the ID of the control:
string controlId = Page.Request.Form["__EVENTTARGET"];

Though I don't think that is documented behaviour, it's how ASP
manages control events under the hood, so could change in future
versions of ASP.
Thanks, that's exactly what I was looking for :)

Sorry for posting into the wrong forum, I didn't know there was an
asp.net forum as well :).

Jun 4 '07 #4

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

Similar topics

3
by: lphuong | last post by:
When someone modifies a field in a table, I like to find out which field he/she changed. Currently, only the LAST person to modify an object is saved. For example, if I modify an Application...
1
by: Ole Nielsen | last post by:
Hi I have an application written in VB.NET that needs to trigger an action on a Webpage. For other actions in communicating I've been using WebRequest.Create / WebRequest.Method, but I dont...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
2
by: André | last post by:
Hi, is it possible to trigger an action (e.g. make visible a button) when clicking in a particular field of a detailsview? I think is it, but how? I tried it on several ways, but no succes....
3
by: Terry | last post by:
Hi, I have a button ("button1") embedded into another control ("LoginView1"). In the code-behind environment of VWD (visual web dev.), i cant' use the event button1_onclick because 'button1'...
0
by: =?Utf-8?B?aXdlYg==?= | last post by:
We have an ASP, ASP.net business application. Can we set Auto Mail alerts on some Trigger or Action? Where can we get code / guidance for the same? Akshay.
2
by: maralfarshadi | last post by:
Hello In my JSP, I have several comboboxes (located in several forms in one JSP). In the onChange event , I have : onchange="submit()" My combobox have the values : Select Item Action 1...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
6
by: viny2cool | last post by:
Hey guys I am trying to create an trigger, but getting this error. My code is as follows CREATE OR REPLACE TRIGGER vendorpricingTR BEFORE UPDATE OF pricing ON vendors FOR EACH ROW DECLARE ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
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...
0
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

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.