Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 February 22nd, 2007, 02:19 PM
Authorized User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jlrolin Send a message via MSN to jlrolin
Default Capturing Button Click in Page_Init?

Is it possible to capture a button click during the Page_Init?

I have a page that has a dropdown list on it. Usually it has 2 to 3 dates. When I change the date, it autopostbacks and when it hits Page_Init, it loads a list of entries into a table, each row having a checkbox.

When I want to Submit the checkboxes, the page is running Page_Init first, obviously. I don't need to do that. I can't use a Page.IsPostBack restriction because I don't want to run anything in the Page_Init when the button is clicked, it will run after the Process is ran, and redirects back to the page.

Is there any way possible to not have the Page_Init load first, but have the button process run, then redirect back to the page, and bam, I have my page back?

________________________
ASP.NET 1.1 Developer
VB.NET Developer
__________________
________________________
ASP.NET 1.1/2.0 Developer
VB.NET Developer
 
Old February 22nd, 2007, 02:26 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

No. The page life cycle will always exectue in a Top Down order and you can't specific that you want x method to fire before the Page_Init.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
 
Old February 22nd, 2007, 03:29 PM
Authorized User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jlrolin Send a message via MSN to jlrolin
Default

I just need to skip the functions within the Page_Init when submitting something. I know there is a way that you can find out what control is posting back. If it is the button, I skip the functions, and move to processing the information, then when the page redirects, it will load the data back up.

________________________
ASP.NET 1.1 Developer
VB.NET Developer
 
Old February 22nd, 2007, 03:38 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This is a helper function that I use when I need to preform something like this, though I have only used it with buttons and DDL's you may have to tweak it for use with anything else.

private bool didControlPost(string sID)
{
 return (!(Request.Form[sID] == null)) || (!(Request.Form["__EVENTTARGET"] == null) && Request.Form["__EVENTTARGET"].Equals(sID)) || ((!(Request.Form[sID + ".x"] == null)) && (!(Request.Form[sID + ".y"] == null)));
}

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429





Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing Mouse Click Event whiterainbow ASP.NET 1.0 and 1.1 Professional 1 December 8th, 2005 01:44 AM
Button Click ~Bean~ ASP.NET 1.0 and 1.1 Basics 2 September 27th, 2005 09:32 AM
Login Click Button mrideout BOOK: Beginning ASP.NET 1.0 6 August 12th, 2004 10:11 AM
Print on Button Click mahulda ASP.NET 1.0 and 1.1 Basics 2 August 5th, 2004 02:50 PM





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