I have set up a function which returns an enum of the button that the user clicked in the ModalPopup. I have a variable of type enum to store which button the user clicks in the button click event. In this function, I call the ModalPopupExtender's Show() method.
My problem is, the function finishes out and returns the default enum (which is "none" since no button was clicked yet) before the ModalPopup can be shown and store which button the user clicks.
So without changing the function to a method and using a different way to store the user's button click, how can I pause the function after the Show() method of the MPE has been called and wait for the user to click a button?
Edit(11/20/2009):
Clarification:
On the aspx page, I include a ScriptManager, PlaceHolder, and an asp:Button with a codebehind click event. What I want is to click the button, then in the click event handler, I want to call a custom static class function that returns a variable. One of the arguments it takes is the PlaceHolder. The function creates all the necessary controls in the PlaceHolder needed to display a ModalPopup. It calls the created ModalPopupExtender's Show() method.
What should happen:
At this point is the ModalPopup gets displayed, the user clicks a button, that button's event handler fires, the button sets a variable indicating that it was clicked, it then calls the ModalPopupExtender's .Hide() method, and then the function returns the variable that indicates which button was clicked. We then return to the event handler from the original button that was clicked and the programmer can then perform some logic based on what variable was returned.
Crux:
When the ModalPopupExtender's .Show() method gets called, it does not display the ModalPopup until AFTER the function returns a default variable (because no button was clicked yet) and after the event handler from the original button that was clicked ends.
What I need:
After the ModalPopupExtender's .Show() method is called, I need the ModalPopup to get displayed immediately and I need the function to wait for a button click to be made from the ModalPopup.
My thoughts:
Some PostBack needs to be made to the page telling it to update and display the ModalPopup Panel. Then maybe a while loop can be run in the function that waits for a button to be clicked in the ModalPopup.