Hi
I have an aspx page that has a datagrid and a print button
i have a javascript function :
function PrintPage(){
if (window.print) {alert('print');window.focus(); window.print(); }
else {alert('This script does not work in your browser');}
//history.back();
//return false;
}
on the print buton click i have
private void btnPrint_Click(object sender,
System.Web.UI.ImageClickEventArgs e) {
pnlTopButtons.Visible = false; // hide some buttons
pnlPrintButtons.Visible = false;// hide some buttons
pnlUsdQty.Visible=false; // hide some buttons
Page.RegisterStartupScript("jsPrint","<script
language=JavaScript>javascript:PrintPage();</script>");
}
the thing is :
<script language=JavaScript>javascript:PrintPage();</script>
is in the page , is the last thing before </form>
the javascript is being called, the alert is fired but not the print
part of the script , no printer dialog box , but in firefox the dialog
box is being displayed.
is it a bug with IE ?, is there a work around ?
thanks i really need this
Eliyahu Goldin - 31 Oct 2005 15:18 GMT
There is no window.print property in IE.
Eliyahu
> Hi
>
[quoted text clipped - 32 lines]
>
> thanks i really need this
Sreejith Ram - 31 Oct 2005 16:40 GMT
Code looks correct to me...
what happense , if you remove all other lines and use only window.print();
in the PrintPage() function ?
I think, the only way to find this would be step by step debugging, unless
there is a known MS IE bug. :)
> Hi
>
[quoted text clipped - 32 lines]
>
> thanks i really need this
fredd00 - 31 Oct 2005 18:39 GMT
if i only leave window.print() , nothing happens
the page is loaded and that's it
Sreejith Ram - 31 Oct 2005 20:59 GMT
But it still works in firefox.. ?.. strange!
I tried the code you posted in first post (only the PrintPage() function ,
not the post back etc) in IE version 6.0.2900.2180 on Win XP SP2 and it
worked just fine..
you may want to try in a different machine, compare IE versions etc
> if i only leave window.print() , nothing happens
> the page is loaded and that's it