Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a modal dialog that I call from my sender page:

function openCommentsDialog( ITEMID)

     {




    var DropDownListValue = document.getElementById("HideVal").value;


    var options = SP.UI.$create_DialogOptions();
    options.url = "/_layouts/SRP/SRPChange2.aspx" + "?Type=" + DropDownListValue    + "&ItemID=" + ITEMID;        //"SRPChange.aspx" + "?Type=" + DropDownListValue +"&ItemID=" + ITEMID;
        options.height = 600;
        options.width = 800;
        options.allowMaximize = false;

        options.Title = "SRP Change Dialog";
        **options.dialogReturnValueCallBack = Function.createDelegate(null,  dialogCloseCallBack);**
        SP.UI.ModalDialog.showModalDialog(options);

}

This is the callback function on the sender page:

        function dialogCloseCallBack(result, returnValue) {

         SP.UI.ModalDialog.RefreshPage(result);
     }

On the dialog page I have dynamically added a "Close" button. I have tried client script and server script but the diaglogCloseCallBack function on the sender page never fires:

Client:

<script type="text/javascript">

function closeWindow() {

    SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.Close,null);

    }

Server:

private void Close_OnClick(object sender, EventArgs e)
    {
        this.Context.Response.Write("<script type='text/javascript'>window.frameElement.commonModalDialogClose(0,null);</script>");
        this.Context.Response.Flush();
        this.Context.Response.End();
    }

-->

share|improve this question
    
Why have you added a close button dynamically? Won't the options.showClose = true work? –  Vardhaman Deshpande Jul 2 '12 at 17:27
    
When I do that the Close button doesn't show up. –  user8746 Jul 2 '12 at 19:29
    
Even when I click the "X" to close the window, the delegate event doesn't fire. –  user8746 Jul 2 '12 at 20:11
    
Can you try changing your function to: function dialogCloseCallBack(result, returnValue) { alert(result); } and then clicking on the "x" to close. –  Vardhaman Deshpande Jul 2 '12 at 20:35
    
The dialogCloseCallBack function doesn't fire. That is the problem. –  user8746 Jul 2 '12 at 20:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.