OnTheAnvil Posted June 7, 2005 Posted June 7, 2005 On my Page_Load event I want to test to see if a user clicked the Save button. Or another way of saying this is during the Page_Load I want to see if the btnSave_OnClick event is going to fire sometime after the Page_Load event. Is there any way to do this. Maybe looking through some events object or queue? Thanks, OnTheAnvil Quote
Administrators PlausiblyDamp Posted June 7, 2005 Administrators Posted June 7, 2005 Out of curiosity - why? Wouldn't it be easier to handle the event in the button click itself rather than the page load? It may help if you give a bit more detail about what you are trying to do as there be a better way. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
thenerd Posted June 7, 2005 Posted June 7, 2005 dim thisbool as boolean private sub page_load() thisbool = true end sub private sub button_click() if thisbool = true then whatever() end if end sub Quote
OnTheAnvil Posted June 7, 2005 Author Posted June 7, 2005 Thanks for the suggestion TheNerd but that is actually the reverse of what I want. Damp, on my page I have a grid that has checkboxes in one column. Users check various boxes and click Save. Depending on other conditions on the page I sometimes need to call a function to completely repopulate the grid(gridRefresh) during the page load ( and yes it does need to happen on the page load not the page_prerender). When I do this it destroys any information about the state of the checkboxes. If I've done the gridRefresh on the page load and then the the btnSave_OnClick event fires it believes that no checkboxes where checked because the gridRefresh has cleared the state of the grid. I can probably come up with an elaborate work around for this but if I just knew if the btnSave_OnClick was going to be called I could simply not call gridRefresh. Let me know if you need more info. Thanks Quote
Administrators PlausiblyDamp Posted June 7, 2005 Administrators Posted June 7, 2005 What other conditions do you check to see if the data needs refreshing? Are there any other controls on the page that could cause a post back? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
OnTheAnvil Posted June 7, 2005 Author Posted June 7, 2005 Yes there are other buttons on the page that cause postbacks. Some of these need to trigger the pageRefresh and others don't. Quote
OnTheAnvil Posted June 7, 2005 Author Posted June 7, 2005 I forgot to mention that I can always set a variable using javascript depending on what button is clicked and check that in the Page_Load event but again I'd rather find a simpler way to do this. Sometimes it would just be useful to know what else is still going to happen before the page gets sent back to the client. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.