Wednesday, March 28, 2012

Modal Popup Extender and show/hide

Hi @dotnet.itags.org.all, misters

I am able to wire up an AJAX ModalPopup and everything works fine. But now I want to do the following:

- Before that ModalPopup is shown, I want execute function javascript (custom javascript)

- When the ModalPopup hides, I want execute function javascript (custom javascript)

Any suggestions for my issue ?

Thanks in advance for any help, that will be appreciated and very grateful. I have lastest version of Ajax Toolkit.

Greetings

I assume you are showing the mpe from a button (TargetControlID) and a close closing froma button (CancelControlID). If you change to showith the mpe from javascript and hiding from javascript you can accomplish your needs.

Add:

<script language="javascript">

function showModal(){

//custom code

$find('ModalPopupExtender1').show();

}

function hideModal(){

//custom code

$find('ModalPopupExtender1').hide();

}

</script>

Step 1: Add a style="display:none" attribute to the targetControlID

Setp 2: Remove the cancelcontrolID from the mpe

Step 3: Create a new button outside the popupcontrol ad add the atrribute onclientclick="showModal(); return false;"

Step 4: Create a button inside the popup with the attribute onclientclick="hideModal(); return false;"

This is crude, but it just the steps, obviously you will need to customize to make it work in your app.

-Alan

No comments:

Post a Comment