473,503 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I tell what button was clicked from within Page_Load

Hi Gang,

I have a dillema I need to know what button was clicked while I'm still
in the Page_Load event. Surely there must be a class that reveals
this?

Thanks,
Christian Blackburn

Jul 1 '06 #1
3 1315
See article "Which Control Generated My Postback" here:

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

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Christian Blackburn" wrote:
Hi Gang,

I have a dillema I need to know what button was clicked while I'm still
in the Page_Load event. Surely there must be a class that reveals
this?

Thanks,
Christian Blackburn

Jul 1 '06 #2
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:A3**********************************@microsof t.com...
See article "Which Control Generated My Postback" here:

http://www.eggheadcafe.com/articles/20050609.asp
In my experience, needing to know which control initiated the postback from
within one of the Page_xxx events is *almost* always symptomatic of a poorly
designed page or, at the very least, a lack of understanding of the event
hierarchy...
Jul 2 '06 #3
Mark,
You are 100% correct. If Mr. Blackburn's buttons are evented properly he
should simply see that the buttonX_Click event is fired on a postback and
that his code inside the handler is run. However, it can still be useful for
developers to understand how the mechanism works.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mark Rae" wrote:
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:A3**********************************@microsof t.com...
See article "Which Control Generated My Postback" here:

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

In my experience, needing to know which control initiated the postback from
within one of the Page_xxx events is *almost* always symptomatic of a poorly
designed page or, at the very least, a lack of understanding of the event
hierarchy...
Jul 2 '06 #4

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

Similar topics

5
8955
by: Logger | last post by:
Help, I’m trying to implement a confirm button on an asp.net page. I have it attached to a asp:button control. In the button1 click event I call the CreateConfirmBox subroutine. The Box comes...
6
3847
by: Rod Snyder | last post by:
I'm trying to set up a page with an asp.net link button that would send a user to a certain page and on page load execute a specific stored procedure tied to the button on the previous page. The...
7
16002
by: Amadelle | last post by:
Hi all and thanks in advance, I am stuck! I can't figure out how to identify which button was clicked on my ASP.NET page in the PostBack event? So what I am trying to do is to is to have an if...
2
2783
by: Krista Lemieux | last post by:
Hello, In my form I have a button, and the button_Click function (which gets called when the button is clicked). However the functionality that I have in the button_Click function, needs to be...
4
1887
by: Shawn | last post by:
Hi. I have a ToolBar with a couple of ToolBarButtons. On postback after clicking on of the buttons Page_Load is called first then the ToolBarButton's click event is called. Is there anyway for...
0
1371
by: Alex | last post by:
Hi there! I got some LinkButtons, all declared as "Public Withevents buttonName as LinkButton". I know the button names and IDs. Now I want to check in the Page_Load Method which button was...
7
1853
by: Jimmy Jazz | last post by:
Hi, I have created a control with some buttons an alphabet. When one of these buttons are pressed it posts back and in the postback event for the button pressed a list of tems is created with a...
4
1418
by: bbawa1 | last post by:
I have a button( btnLogOut)in my master page. In page_load event of this master page I want to verify if the button is clicked or not. How can I do that. Thanks in advance. seema
4
1501
by: =?Utf-8?B?c21heQ==?= | last post by:
I'm trying to raise the click event of a button from my Page_Load event so that after the Page_Load completes the myBtn_Click event is fired, just as if a user had clicked the button. I can't just...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.