Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1185
Javascript to change Webdialog window contents (HTML)
posted

I'm puzzled by the CSOM documentation, and am not sure what method/properties I should be using. I'd like to use a webdialogwindow to display client side messages (as a better formatted version of Confirm/Alert). I can populate its contents server side easily enough, but I'd like the option of filling it on the client end too.

I don't want to give it a URL, I want to edit the content of an existing control within the content pane (labels or asp:Literal or suchlike).

Parents
No Data
Reply
  • 255
    Verified Answer
    Offline posted

    I am doing something similar.  I have a userControl with a label inside the WebDialogWindow content pane template.  Then I use jQuery to manipulate the content.  My javascript "Alert" function is:

    function wjDlgMsg_show(sCaption, sMsg, sHeight)
    {
       // get the dialog
       var dialog = $find("ctlDlgMsg_dlgIMsg");
      
       // use jQuery to set the caption
       $("#ctlDlgMsg_dlgIMsg  .igdw_wgOfficeBlueHeaderCaption").text(sCaption);

       // use jQuery to set the label content (as html)
       $("#ctlDlgMsg_dlgIMsg  .lblPopMsg").html(sMsg);

       // show the dialog
       dialog.show();

       // set dialog height.  Could not figure out how to calculate it automatically
       // NOTE:  docs say parameters are height, width, ...
       // actual parameters are:  width, height, ...
       if (sHeight != "")
          dialog.setSize(null, sHeight, null);
      
       // Can also set the caption here (must be done after dialog is shown)
       //dialog.get_header().setCaptionText(sCaption);
    }
     

Children