0

I have a modal popup extender on a parent form (called from a child aspx is in an iFrame). I'm able to show it by calling

parent.ShowModal();

Which is a javascript function on the parent page that executes $find('ModalPopupExtender1').show();

It works great. But now I've discovered a new problem.

After the VB code-behind is finished executing on the child page, I'd really like to hide that modal form. Don't get me wrong, I have nothing against modal popups. I rather like them in fact. It's just that my users would like it better if they could continue working after the VB code-behind (child page) is finished executing. I tried

ParentForm.ModalPopupExtender1.Hide()
Top.ModalPopupExtender1.Hide

But I haven't had any luck.

Any help would be greatly appreciated.

Thanks,

Jason

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794

1 Answers1

0

Okay, here's the solution I found (in case anybody else needs it).

Don't try to reference the parent's controls directly from VB. Instead, create a java function in the parent aspx (like this):

function HideModal()
    {$find('ModalPopupExtender1').hide();}

Then, create a java function in the child aspx page like this:

function HideModal()
    {parent.HideModal();}

Finally, create the following in the VB code-behind of the child aspx

        strScript = "<script language=" & Chr(34) & "javascript" & Chr(34) & " id=" & Chr(34) & "MyClientScript" & Chr(34) & ">HideModal();</script>"
        ClientScript.RegisterStartupScript(Me.GetType(), "HideModal", strScript)

Worked pretty good!