Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • trfletch 595 posts 571 karma points
    Feb 24, 2012 @ 17:33
    trfletch
    0

    Closing umbraco modal window in datatype rebinding data

    Hi,

    I have created a custom datatype that includes a gridview with a button on each row that opens a modal window to ask for confirmation of the action. The javascript to open the confirmation window is as follows:

    <script type="text/javascript">
    function openOptInConfirm(id) {
    UmbClientMgr.openModalWindow(
    '/testpage.aspx?id=' + id, 'Confirm window', true, 300, 130, 80, 0, '', '');
    }
    </script>

    The testpage.aspx page contains two buttons, Yes and No.

    What I need to know is how if the user clicks "No" I make it so that the modal window closes. And if they click "Yes" then the modal window closes and it rebinds the grid within my custom datatype to show the changes?

    I did try the following code from another post but this seemed to refresh the page behind but it displayed a warning saying that data would be re-submitted and it did not close the modal window, can anyone help or suggest a better way for doing this?

    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.Append(@"<script language='javascript'>");
    sb.Append(@"parent.document.getElementById('right').contentWindow.location.reload(true);top.closeModal();");
    sb.Append(@"</script>");
    
    ScriptManager.RegisterStartupScript(btnNo, this.GetType(), "JSCR", sb.ToString(), false);

     

     

     

     

     

     

     

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Feb 24, 2012 @ 17:38
    Jeroen Breuer
    0

    In DAMP I use this to close: 

    <a href="#" onclick="UmbClientMgr.closeModalWindow()">No</a> 

    If you click yes I guess you can call some different javascript to do that.

    Jeroen

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies