Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 20th, 2004, 04:37 PM
Registered User
 
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default which button got clicked in Page Load

Hi,


I need to find out which button got clicked on the page in page load event.

Thanks for your help

-Guri

 
Old August 20th, 2004, 07:55 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

You need to explain a little... You want to have multiple submit buttons in one form and then figure out which one the user clicked in the page it posts to?

I would use JavaScript to set a hidden input to a certain value onSubmit depending on which button was clicked, then read the input with ASP.NET.

HTH,

Snib

<><
 
Old August 21st, 2004, 01:56 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Or maybe easier, why not leave Page_Load to what is was made for (load the page) and then use a Click handler to handle the button clicks? You could set up one method that handles both clicks, if you need, and then inside that method look at the sender that is passed to the method.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 22nd, 2004, 01:33 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

when your page loads the events occurd are in this order
.(like Page_Init)
.
.
Page_Load
Button_Click
.
.
.(like Page_Unload)
now you can check it in Button_Click instead of Page_Load easier and better.
I dont think you could handle it in Page_Load.

--------------------------------------------
Mehdi.:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
flash button not causing page load event olambe Flash (all versions) 3 June 22nd, 2007 10:17 PM
How to know whick button was clicked. KingArthur Struts 1 February 22nd, 2006 07:12 AM
How to tell which button clicked emily PHP How-To 2 November 30th, 2004 01:35 PM
flash button not causing page load event olambe BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 27th, 2004 09:02 PM
links to a page when a button is clicked hosefo81 HTML Code Clinic 4 December 7th, 2003 06:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.