473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Printing Problem - II (in aspx page)

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
0 1861

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: wolfiecat | last post by:
Hello - I am new to this forum. Let me start off by saying that I have never used ASP before. I am working on a project where the site was already created using frames and .aspx pages. I was...
2
by: Fred | last post by:
I have an aspx page: Main.aspx which has several components that cause a postback. In the page Main.aspx I also have an iframe which contains a multi-page pdf file. The problem I am facing is...
1
by: John Klucker | last post by:
Can anyone tell what easiest way to implement 'Printer Friendly' functionality to my .aspx page. Are there any controls available or is there something in the framework? Thanks in Advance!! ...
1
by: MrMike | last post by:
Hi. I have an aspx page which displays data on about the top 1/3 of the page, and the remaining 2/3 of the page is blank. The page is formatted so that my users can print the page to...
0
by: RRKV | last post by:
Hi I have a datagrid which contains 4 rows and a checkbox. when the checkbox is selected and click the print button it should create an .aspx page which contains all the data and directly goes to...
0
by: Niyazi | last post by:
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)...
1
by: =?Utf-8?B?THluZGE=?= | last post by:
In my web application, I am using two different CSS based on media. In my Print CSS, I can suppress button, header and ad objects using "Display: None;". However, I need to print an object that...
8
by: jay123 | last post by:
hello, i really need help from you experts. my problem is i have one page abc.aspx, and then their is other page called def.aspx(which is printable version), which gives some information used...
2
by: | last post by:
How does IE6 and IE7 work when printing an aspx page, does it initially format the page according to the default printer on the PC? Or does it have it's own method for formating a page for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.