Print contents of a modal popup

后端 未结 4 1404
眼角桃花
眼角桃花 2020-12-22 07:26

I have an application that shows a list of items.

The user can click on an item and see its details in a modal popup (centered DIV, shown using JavaScript). I need t

4条回答
  •  抹茶落季
    2020-12-22 08:01

    To render the popup contents with a different style (e.g. not centered, 100% width) I dynamically update the position of the _foregroundElement (the PopupControlID) and _backgroundElement (created by the popup extender) on print.

    var basePrint = window.print;
    window.print = function() {
      var popup = $find( '<%= [PopupExtenderID].ClientID %>' );
      popup._backgroundElement.style.position = 'static';
      popup._foregroundElement.style.position = 'static';
      popup._layout();
      basePrint();
      // Restore settings for display
      popup._backgroundElement.style.position = 'fixed';
      popup._foregroundElement.style.position = 'fixed';
      popup._layout();
      }
    

    Note: Won't work with browser's print button.

提交回复
热议问题