Usercontrol Buttons

ryan1107

Newcomer
Joined
Aug 3, 2004
Messages
16
I am working on an asp.net project that has a usercontrol that is being used for the page heading. There are three buttons for navigation.

There are four aspx pages that use the usercontrol.

On one of the pages, I need to check to see if changes have been made when any of the buttons are clicked and ask the user if they want to save changes.
- I got this to work by adding an eventhandler to the page and doing a raiseevent when a button is clicked.


The other pages do not need to check for changes when the buttons are clicked.
- I have tried adding an eventhandler and doing a raiseevent when a button is clicked, but it doesn't do anything.

How would you recommend solving this problem? Even if I can get the eventhandler to work on the other tpages, I don't like having to duplicate routines in each of the pages.

I could also move the buttons out of the usercontrol and have them on each page, but this also creates duplicate code.

Recommendations?

Thanks!
 
If the control raises an event you would only need to handle it in the one page that needs to check for changes - the other 3 pages wouldn't need to have an event handler for the control and no code would be run
 
Back
Top