views:

942

answers:

1

Here's the situation.

When a user is editing a given piece of data, they're allowed to add messages/comments. These are stored as child records in a SQL database. Clicking on the Add Message button brings up a panel (pnlMessage) courtesy of the AJAX ModalPopup Extender. This takes some input and, when the "Send Message" button in the panel is clicked (I learned the hard way to NOT make that the 'OkButton' property), the message is stored in the database and an email is sent to the intended recipients. No problem there.

However, I need to be able to allow the user to add new email addresses (so long as they are registered in our database). I have another ModalPopup / panel combo (pnlSearch) that's tied to a button on the previous panel (pnlMessage).

The user is supposed to be able to add an email or click on a search button to populate a list to choose from.

The pop-up panel (pnlSearch) comes up just fine, but clicking the "Lookup" button (which instigates the search and returns a collection of records that the user is supposed to pick from) closes the panel.

Previously, I ran into the problem of having the Button.Click event never firing when I put the Button into the "OkControlID" property (the CancelControlID works fine since I don't want to do anything). Removing the "OkControlID=Button" line allowed it to work perfectly with the Button.Click event firing as expected.

So now I have the Search panel with a button for "OK" and a button for "Search" - but the panel should stay up and visible after the Search.Click does it's thing. Am I missing some property that basically says "don't close the panel when this button is clicked"? Of course, if I bring up the panel again in the same session, the results from the previous effort are there (the search results).

I'm trying to avoid having to go to javascript as there isn't much, if any, of that experience available to support this.

Help!

Thanks in advance.

+1  A: 

You can put the Search panel and the Search button inside of an UpdatePanel. Anything inside of the UpdatePanel will be able to post back without closing the popup. Be sure not to put the buttton that is supposed to close the popup inside of the UpdatePanel.

samiz
So I would basically be targeting the ModalPopupExtender to an *UpdatePanel* instead of a "regular" panel? Sounds almost too good (easy) to be true :) But, then, I don't have a lot of asp.net experience so I don't know all the webforms controls intimately - certainly not as well as I know the winforms controls. Thanks!
David
Unfortunately the "Pick me and continue" button needs to be on the search panel (so that it's guaranteed not to be occluded when the panel comes up) and there doesn't seem to be a way to close the UpdatePanel (Search) from inside the button.click event.
David