devonbetts
asked on
Event Handlers: Priority and Order of Operation
Hi there I am trying to dynamically add an event handler to a button on an asp.net page from a web control that is to be put on the page.
Essentially it adds a new click event handler to the submit button on a page so that in addition to the original event already designated on the page it also will run a method that is contained in the web control. So I will be able to drop the web control onto any page and it will add the event and run without having to do any further editing to that page. It searches for any buttons or imagebuttons with a tooltip that reads "Submit".
Anyway that works fine and dandy, it adds the eventhandler to the correct control (confirmed with breakpointing). The problem I have encountered is that because the eventhandler is being added in the webcontrol the eventhandler has a lower priority than the already existing one. Since that button usually does a Server.Transfer or a Response.Redirect the eventhandler added by my webcontrol is never reached.
Is there anyway to change the priority or order in which an eventhandler is called, keeping in mind that they are being added in completely different places and the eventhandler on the page will always be added first?
Essentially it adds a new click event handler to the submit button on a page so that in addition to the original event already designated on the page it also will run a method that is contained in the web control. So I will be able to drop the web control onto any page and it will add the event and run without having to do any further editing to that page. It searches for any buttons or imagebuttons with a tooltip that reads "Submit".
Anyway that works fine and dandy, it adds the eventhandler to the correct control (confirmed with breakpointing). The problem I have encountered is that because the eventhandler is being added in the webcontrol the eventhandler has a lower priority than the already existing one. Since that button usually does a Server.Transfer or a Response.Redirect the eventhandler added by my webcontrol is never reached.
Is there anyway to change the priority or order in which an eventhandler is called, keeping in mind that they are being added in completely different places and the eventhandler on the page will always be added first?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome.
ASKER
Thanks though, that is good to know.