Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
650 Points
682 Posts
May 02, 2012 05:34 AM|LINK
Dear All,
I have a webpage and i got a gridview on it.
On the gridview i have a linkbutton.
On clicking the linkbutton, a popup window will be displayed.
On the popup window I have panel(hidden) and print button.
On clicking the print button, print preview page will be displayed with the panel.
The problem is when the print button is clicked, its not closing the popup window.
how can i close my popup window?
pls help me.
following HTML CODE(JS) to open the print prieview page <script> function PrintPreView() { var pnlA = document.getElementById('<%=pnlCt.ClientID %>'); pnlA.style.display = 'block'; var OLECMDID = 7; /* OLECMDID values: // * 6 - print // * 7 - print preview // * 1 - open window // * 4 - Save As // */ var PROMPT = 1; // 2 DONTPROMPTUSER var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'; document.body.insertAdjacentHTML('beforeEnd', WebBrowser); WebBrowser1.ExecWB(OLECMDID, PROMPT); WebBrowser1.outerHTML = ""; document.write('<body onLoad = "self.close();">'); }</script>
<div> <asp:Panel ID="pnlCt" Style="display: none" runat="server"> </asp:Panel> </div>
FOLLOWING IS VB.NET CODE IN CODE BEHIND
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then btnPrint.Attributes.Add("OnClick", "PrintPreView();return false;") End If End Sub
Thanks Nick
nicklibee
Member
650 Points
682 Posts
how to close a popup window after print preview page is opened?
May 02, 2012 05:34 AM|LINK
Dear All,
I have a webpage and i got a gridview on it.
On the gridview i have a linkbutton.
On clicking the linkbutton, a popup window will be displayed.
On the popup window I have panel(hidden) and print button.
On clicking the print button, print preview page will be displayed with the panel.
The problem is when the print button is clicked, its not closing the popup window.
how can i close my popup window?
pls help me.
following HTML CODE(JS) to open the print prieview page
<script> function PrintPreView() {
var pnlA = document.getElementById('<%=pnlCt.ClientID %>');
pnlA.style.display = 'block';
var OLECMDID = 7;
/* OLECMDID values:
// * 6 - print
// * 7 - print preview
// * 1 - open window
// * 4 - Save As
// */
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
document.write('<body onLoad = "self.close();">');
}</script>
<div>
<asp:Panel ID="pnlCt" Style="display: none" runat="server">
</asp:Panel>
</div>
FOLLOWING IS VB.NET CODE IN CODE BEHIND
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
btnPrint.Attributes.Add("OnClick", "PrintPreView();return false;")
End If
End Sub
Thanks
Nick