By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,719 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,719 IT Pros & Developers. It's quick & easy.

Printing Problem - II (in aspx page)

P: n/a
Hi all,

This my aspx page first line of code.
<%@ Page CodeBehind="index.aspx.vb" Language="vb" AutoEventWireup="false"
Inherits="TB.index" %>

Than inside head tag I have following script(s)
---------------------------------------------------------------------------------------------------------------------
<script language="JavaScript">
//Disable Mouse Right Click Button
var message="Sorry, the mouse right click function is disabled for this
HTML page";

// Don't edit below!

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}

if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}

if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}

document.onmousedown=click;
window.onmousedown=click;
</script>
---------------------------------------------------------------------------------------------------------------------

<script type="text/vbscript">

// PRINT BUTTON ACTIVATED
Sub PrintMe()
document.myLayer.Style.visibility="Hide"
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

//GET SECURITY
################################################## ##############

MySecurity = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enabled")

//GET HEADER and FOOTER INFORMATION
myHeader = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header")
myFooter = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer")

//GET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
size, paper source}
myMargin_Bottom = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom")
myMargin_Top = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top")
myMargin_Left = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left")
myMargin_Right = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right")

//################################################## ########################

// SET SECURITY TO LOW
################################################## ########
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\Safety Warning Level", ""
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enabled", "0"

//SET HEADER and FOOTER INFORMATION
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", ""
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", ""

//SET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
size, paper source}
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom", "0.05"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top", "0.5"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left", "0.3"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right", "0.03"
//################################################## #####################

window.print()

// CLEAR THE TEXT BOXES
txt1.value = ""
txt2.value = ""
txt3.value = ""
txt4.value = ""
txt5.value = ""
txt6.value = ""

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enabled", "1"

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", myHeader
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", myFooter

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom", myMargin_Bottom
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top", myMargin_Top
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left", myMargin_Left
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right", myMargin_Right

End Sub
</script>

Than I have few line of text as normal style and few textBoxes and there not
in form tag.

Than I have following form tag that has only PRINT button.

<form name="form1" method="post" action="">
<input name="Print" type="submit" id="Print" value="Print"
onClick="PrintMe()">
</form>

My problem is page is not printing. In my localhost PC if I choose the
File->PrintView
I am not seeing the page link date or the page number but in the client
machine I am still see the page link date and the page number on top and
bottom of the aspx page.

When I press the print button it clears the text boxes. And when I goto
File->PrintPreview I don't see the print button (that I want to be like that)
but still seeing the top and bottom of the page unwanted text such as link
adress, date, title and page number.

Does anyone know how to over come this problem?

I thank you all for your kind reading to my post and your future help.

Rgds,
GC

Nov 10 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.