Hello. I'm trying to call a function that prints the content of a div
element. I had that javascript code working, but now I must put that code in
the server side, as it is called from another component.
The problem is that it can't find the div control. Don't know why. I paste
the code here:
That's in the aspx.vb file:
Response.Write( "<script>")
Response.Write( " var prtContent = document.getEle mentById(divPri nt);")
Response.Write( "var WinPrint =
window.open('', '','letf=0,top= 0,width=1,heigh t=1,toolbar=0,s crollbars=0,sta tus=0');")
Response.Write( " WinPrint.docume nt.write(prtCon tent.innerHTML) ;")
Response.Write( " WinPrint.docume nt.close();")
Response.Write( " WinPrint.focus( );")
Response.Write( " WinPrint.print( );")
Response.Write( " WinPrint.close( );")
Response.Write( " prtContent.inne rHTML=strOldOne ;")
Response.Write( "</script>")
In the aspx file there is the div control with a datagrid inside.
--
Regards,
Diego F. 3 4442
"Diego F." <di*******@terr a.es> wrote in message
news:Oz******** ******@tk2msftn gp13.phx.gbl... Hello. I'm trying to call a function that prints the content of a div element. I had that javascript code working, but now I must put that code in the server side, as it is called from another component.
The problem is that it can't find the div control. Don't know why. I paste the code here:
That's in the aspx.vb file:
Response.Write( "<script>") Response.Write( " var prtContent = document.getEle mentById(divPri nt);") Response.Write( "var WinPrint = window.open('', '','letf=0,top= 0,width=1,heigh t=1,toolbar=0,s crollbars=0,sta tus=0');") Response.Write( " WinPrint.docume nt.write(prtCon tent.innerHTML) ;") Response.Write( " WinPrint.docume nt.close();") Response.Write( " WinPrint.focus( );") Response.Write( " WinPrint.print( );") Response.Write( " WinPrint.close( );") Response.Write( " prtContent.inne rHTML=strOldOne ;") Response.Write( "</script>")
In the aspx file there is the div control with a datagrid inside.
-- Regards,
Diego F.
Replace:
Response.Write( " var prtContent = document.getEle mentById(divPri nt);")
With:
Response.Write( " var prtContent = document.getEle mentById('divPr int');")
HTH,
Mythran
> Replace: Response.Write( " var prtContent = document.getEle mentById(divPri nt);")
With: Response.Write( " var prtContent = document.getEle mentById('divPr int');")
It was a mistake pasting the code. It's written as you mention.
--
Regards,
Diego F.
"Diego F." <di*******@terr a.es> wrote in message
news:Oz******** ******@tk2msftn gp13.phx.gbl... Hello. I'm trying to call a function that prints the content of a div element. I had that javascript code working, but now I must put that code in the server side, as it is called from another component.
The problem is that it can't find the div control. Don't know why. I paste the code here:
That's in the aspx.vb file:
Response.Write( "<script>") Response.Write( " var prtContent = document.getEle mentById(divPri nt);") Response.Write( "var WinPrint = window.open('', '','letf=0,top= 0,width=1,heigh t=1,toolbar=0,s crollbars=0,sta tus=0');") Response.Write( " WinPrint.docume nt.write(prtCon tent.innerHTML) ;") Response.Write( " WinPrint.docume nt.close();") Response.Write( " WinPrint.focus( );") Response.Write( " WinPrint.print( );") Response.Write( " WinPrint.close( );") Response.Write( " prtContent.inne rHTML=strOldOne ;") Response.Write( "</script>")
In the aspx file there is the div control with a datagrid inside.
-- Regards,
Diego F.
Try:
Dim script As String = _
"<script language=""java script"" type=""text/javascript"">" & vbNewLine
& _
" function WindowPrint() {" & vbNewLine & _
" var prtContent = document.getEle mentById('divPr int');" & vbNewLine
& _
" var WinPrint = window.open(" & _
"'', '',
'letf=0,top=0,w idth=1,height=1 ,toolbar=0,scro llbars=0,status =0');" &
vbNewLine & _
" WinPrint.docume nt.write(prtCon tent.innerHTML) ;" & vbNewLine & _
" WinPrint.docume nt.close();" & vbNewLine & _
" WinPrint.focus( );" & vbNewLine & _
" WinPrint.print( );" & vbNewLine & _
" WinPrint.close( );" & vbNewLine & _
" prtContent.inne rHTML=strOldOne ;" & _
" }" & vbNewLine
Page.RegisterSc ript("WindowPri nt", script)
Then, in your Page_Render, have:
Page.RegisterSt artupScript("Do WindowPrint", _
"<script language=""java script"" type=""text/javascript"">" & vbNewLine
& _
" WindowPrint();" & vbNewLine & _
"</script>" _
)
Hope this works right, off top of head...
Mythran This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: RL |
last post by:
Hello Perl gurus,
1. I have a web page where I can push a button (dospawn.html).
2. This button calls a CGI script (spawnboss.cgi)
3. spawnboss.cgi calls a forking perl script (forkme.pl)
4. forkme.pl calls the process creation script (createme.pl)
5. createme.pl creates my notepad.exe process, but no window shows up on my
PC.
The result on my web browser is:
|
by: Harold |
last post by:
I have page A with form field and a button and when button is clicked it
opens page B in another window. Page B has a treeview control and that is
all. When something is selected I want the page B item to pouplate a form
field on page A. Can this be done and how?
|
by: desmcc |
last post by:
Hi,
I am launching a modal dialog through the usual javascript
(window.showmodaldialog). When the modal dialog is complete (ie user
selects OK), the calling page then refreshes itself by setting the
location.href of the window to be itself (ie the modal dialog changes a
label on the calling page ). I can see that this causes the page load
code of the calling page to execute in the code behind page. I can also
see clearly that this updates...
|
by: stephen |
last post by:
I have created an order form that users javascript to create a new html
document when the customers clicks the "print page" button.
Once the new document has been created it then prints the document and
closes it with the following code:
<body onload="window.print(); window.close();">
This works correctly (or at least the way I expect it to work under MS
Internet Explorer, but it cuases Netscape to "crash"
|
by: Tony Rice |
last post by:
If I've loaded a set of functions in a webdocument like this:
<script language="JavaScript" type="text/javascript"
src="/js/foo.js"</script>
Shouldn't I be able to call a function from inside foo.js later in that
same document by doing something like this:
<script language="JavaScript" type="text/javascript">myfunction(myargs)
| |
by: Opa |
last post by:
Hi ,
I have a form with javasript which launches a popup via the showModalDialog()
method. I get the dialog to open, now I am trying to first get a reference
to the calling form from the popup and then do a refresh of the calling form.
Any ideas on how to get a reference to the calling form?
I tried window.parent.location.reload() , but it doesn't work.
Thanks a lot.
|
by: rgparkins |
last post by:
Hi,
Really stuck with this one, or the fact that I have just had a baby
maybe mind mind is in meltdown and I cant figure how to solve this!
I have a list of users stored in session. These users are displayed in
a list on the admin web page and I would like to give the
administrator a dropdown of actions on this list. For example, print
this list, Email this list etc.
|
by: Kbalz |
last post by:
Having a really hard time finding solid examples on deploying a
CR .NET applcation on my intranet. I'll explain what I've done so far,
and toward the bottom is where I can't print using the report viewer's
gui button.
I have a Windows XP sp2 Client machine used for development, it has
Visual Studio 2005 sp1 and CR XI R2 Developer Version.
My webserver is running Windows Server 2003 sp1, IIS 6.0, has CR XI R2
developer. I have a working...
|
by: Archanak |
last post by:
Hi,
I am using 2-level CSS Drop Down Menu in my perl/CGI program.
here is the code.
#!c:/perl/bin/perl.exe
use CGI qw(:standard);
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |