I'm using a ModalDialog and have a strange issue.
On a button click server side in my popup, I've this line:
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "popData = '" + checkedValue + "';SP.UI.ModalDialog.commonModalDialogClose(1, popData);", true);
Here is what I have in the parent:
LiteralControl lc = new LiteralControl();
lc.Text = @"
<script language='javascript' type='text/javascript'>
function ShowDialog(){
var modalDialog;
var options = {
title: 'Vue détaillée',
allowMaximize: true,
showClose: true,
url:'/_Layouts/Molnlycke.search/PopupSelUrl.aspx',
dialogReturnValueCallback: onPopUpCloseCallBackWithData
};
modalDialog = SP.UI.ModalDialog.showModalDialog(options);
}
function onPopUpCloseCallBackWithData(result, returnValue){
document.getElementById('"+ tbUrl.ClientID +"').value = returnValue;
}
</script>";
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "JS", lc.Text);
and my button:
<asp:Button ID="btSelUrl" runat="server" OnClientClick="ShowDialog()" Text="Open popup"/>
I correctly receive the value in the parent windows, but it doesn't close the popup.
If I click a second time, it closes the popup.
Do you know what the mistake is?