views:

1442

answers:

2

I currently open a pop up window from my parent page using using a JavaScript .showModalDialog function. The pop up window contains some ASP.NET validation controls which do not display when the user clicks the ASP.NET button to submit the form. If there is an error on the page, the validation message(s) do not display, the record is not updated on the server side and the pop window closes.

(The asp.net validation controls do not stop the pop up window from doing a server postback)

Has anyone expereinced this behavior before and is there any way to prevent it?

Here is my showModalDialong call source code:

function OpenChildWindow(id)
{
    var sFeatures = sFeatures="dialogHeight: 525px;";
    sFeatures += "dialogWidth: 900px;";
    sFeatures += "scroll: yes;";
    sFeatures += "status: no;";
    sFeatures += "resizeable: no;";

    var url = "MyPopUp.aspx?ID=" + id;
    var childName = "ChildForm";

    entryWindow = window.showModalDialog(url, childName, sFeatures);

    if (entryWindow == true)
    {
        window.document.getElementById("<%= btnUpdateParent.ClientID %>").click();
    }
}

Note: When the pop up modal is closed, a ASP.NET button is "clicked" to update an ASP.NET UpdatePanel on the parent to show the changes to the record modified in the pop up window.

+1  A: 

I think this may be due to a notorious problem with modal dialogs and postbacks. You can try adding the following in the head tag of the page which you open with window.showModalDialog

<base target="_self" />
korchev
My page opened in the modal box is using a master page shared by all of pages within my application.
Michael Kniskern
I tried adding <base target="_self" /> to the master page and it did not work.
Michael Kniskern
A: 

Did you add it to the OPENED (= the dialog page) PAGE ?

Dan Erez