views:

111

answers:

1

I have a ModalPopupExtender inside an UpdatePanel which opens an input form. The problem is when I click the "Edit" button (which is also inside the UpdatePanel) I want to fill the form with existing values using server side code. But it OnClick method of the button doesn't seem to work.

My question is: How can I make the serverside code run first, than show the edit form?

A: 

You need to show the ModalPopupExtender from server side. First, link the ModalPopupExtender's TargetControlID to a dummy hiddenfield or a button with style="display:none" instead of the "Edit" button. I know it's sound stupid, but it's a know workaround.

Then make sure the asp.net the "Edit" button is set as a asyncpostbacktrigger if children as trigger is set to false.

Also set CausesValidation="false" to avoid the postback to be blocked by unrelated validators on the page.

Finally, At the end of "Edit" button's click event, call ModalPopupExtender.Show() to display the pop up.

DavRob60