473,398 Members | 2,380 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,398 software developers and data experts.

Printing From Modal Dialogs

I have an aspx page that has a print button on it. The code for the
Clicked Event of the Print button is:

Dim strScript As String
strScript = "<script language='javascript'>"
strScript += "window.print();"
strScript += "</script>"
Page.RegisterStartupScript("print", strScript)
The aspx page above is opened using the following code from another
aspx page:

strScript = "var windowOptions = 'dialogHeight: 400px; dialogWidth:
600px;
center: yes; help: no; resizable: no; status: no;'; "
strScript += "window.showModalDialog(page.aspx?v1=" + CStr(intVar1) +
"&occ=" + CStr(intVar2) + "&loc=" + CStr(intVar3) + "&total=" +
CStr(intNumBooks) + "&totald=" + CStr(intNumDiagBooks) + "', null,
windowOptions);"

Page.RegisterStartupScript("SuccessScript", "<script
language='javascript'>" + strScript + "</script>")

When compiled and ran locally, the print button will envoke the Print
dialog. If I compile the same code and run it from my server the
button does nothing. Anyone know why and what I can do to fix this?
Nov 19 '05 #1
6 1747
There can not be postback directly in modal dialogs.
You can for example put your aspx page into iframe in htmlpage or BETTER
replece your server button with something like this :
<button onclick='window.print()'>Print</button>
"Lisa" <li**********@gnb.ca> wrote in message
news:fd*************************@posting.google.co m...
I have an aspx page that has a print button on it. The code for the
Clicked Event of the Print button is:

Dim strScript As String
strScript = "<script language='javascript'>"
strScript += "window.print();"
strScript += "</script>"
Page.RegisterStartupScript("print", strScript)
The aspx page above is opened using the following code from another
aspx page:

strScript = "var windowOptions = 'dialogHeight: 400px; dialogWidth:
600px;
center: yes; help: no; resizable: no; status: no;'; "
strScript += "window.showModalDialog(page.aspx?v1=" + CStr(intVar1) +
"&occ=" + CStr(intVar2) + "&loc=" + CStr(intVar3) + "&total=" +
CStr(intNumBooks) + "&totald=" + CStr(intNumDiagBooks) + "', null,
windowOptions);"

Page.RegisterStartupScript("SuccessScript", "<script
language='javascript'>" + strScript + "</script>")

When compiled and ran locally, the print button will envoke the Print
dialog. If I compile the same code and run it from my server the
button does nothing. Anyone know why and what I can do to fix this?

Nov 19 '05 #2
Perhaps it is your IE security settings. This is all clientside code though,
and not really server so you may want to ask in a javascript group.

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Lisa" <li**********@gnb.ca> wrote in message
news:fd*************************@posting.google.co m...
I have an aspx page that has a print button on it. The code for the
Clicked Event of the Print button is:

Dim strScript As String
strScript = "<script language='javascript'>"
strScript += "window.print();"
strScript += "</script>"
Page.RegisterStartupScript("print", strScript)
The aspx page above is opened using the following code from another
aspx page:

strScript = "var windowOptions = 'dialogHeight: 400px; dialogWidth:
600px;
center: yes; help: no; resizable: no; status: no;'; "
strScript += "window.showModalDialog(page.aspx?v1=" + CStr(intVar1) +
"&occ=" + CStr(intVar2) + "&loc=" + CStr(intVar3) + "&total=" +
CStr(intNumBooks) + "&totald=" + CStr(intNumDiagBooks) + "', null,
windowOptions);"

Page.RegisterStartupScript("SuccessScript", "<script
language='javascript'>" + strScript + "</script>")

When compiled and ran locally, the print button will envoke the Print
dialog. If I compile the same code and run it from my server the
button does nothing. Anyone know why and what I can do to fix this?

Nov 19 '05 #3
Hello Lisa,

Try putting <base target="_self"/> in the .aspx for your dialog.

--
Matt Berther
http://www.mattberther.com
I have an aspx page that has a print button on it. The code for the
Clicked Event of the Print button is:

Dim strScript As String
strScript = "<script language='javascript'>"
strScript += "window.print();"
strScript += "</script>"
Page.RegisterStartupScript("print", strScript)
The aspx page above is opened using the following code from another
aspx page:

strScript = "var windowOptions = 'dialogHeight: 400px; dialogWidth:
600px;
center: yes; help: no; resizable: no; status: no;'; "
strScript += "window.showModalDialog(page.aspx?v1=" + CStr(intVar1) +
"&occ=" + CStr(intVar2) + "&loc=" + CStr(intVar3) + "&total=" +
CStr(intNumBooks) + "&totald=" + CStr(intNumDiagBooks) + "', null,
windowOptions);"

Page.RegisterStartupScript("SuccessScript", "<script
language='javascript'>" + strScript + "</script>")

When compiled and ran locally, the print button will envoke the Print
dialog. If I compile the same code and run it from my server the
button does nothing. Anyone know why and what I can do to fix this?

Nov 19 '05 #4
try this..

<script language="javascript">
window.name = "Popup"
</script>

<form id="Form1" method="post" target="Popup" runat="server">


"Lisa" wrote:
I have an aspx page that has a print button on it. The code for the
Clicked Event of the Print button is:

Dim strScript As String
strScript = "<script language='javascript'>"
strScript += "window.print();"
strScript += "</script>"
Page.RegisterStartupScript("print", strScript)
The aspx page above is opened using the following code from another
aspx page:

strScript = "var windowOptions = 'dialogHeight: 400px; dialogWidth:
600px;
center: yes; help: no; resizable: no; status: no;'; "
strScript += "window.showModalDialog(page.aspx?v1=" + CStr(intVar1) +
"&occ=" + CStr(intVar2) + "&loc=" + CStr(intVar3) + "&total=" +
CStr(intNumBooks) + "&totald=" + CStr(intNumDiagBooks) + "', null,
windowOptions);"

Page.RegisterStartupScript("SuccessScript", "<script
language='javascript'>" + strScript + "</script>")

When compiled and ran locally, the print button will envoke the Print
dialog. If I compile the same code and run it from my server the
button does nothing. Anyone know why and what I can do to fix this?

Nov 19 '05 #5
Hello vinay,

This is the same idea as doing

<base target="_self"/>

albeit, much less convoluted...

--
Matt Berther
http://www.mattberther.com
try this..

<script language="javascript">
window.name = "Popup"
</script>
<form id="Form1" method="post" target="Popup" runat="server">

"Lisa" wrote:
I have an aspx page that has a print button on it. The code for the
Clicked Event of the Print button is:

Dim strScript As String
strScript = "<script language='javascript'>"
strScript += "window.print();"
strScript += "</script>"
Page.RegisterStartupScript("print", strScript)
The aspx page above is opened using the following code from another
aspx page:

strScript = "var windowOptions = 'dialogHeight: 400px; dialogWidth:
600px;
center: yes; help: no; resizable: no; status: no;'; "
strScript += "window.showModalDialog(page.aspx?v1=" + CStr(intVar1) +
"&occ=" + CStr(intVar2) + "&loc=" + CStr(intVar3) + "&total=" +
CStr(intNumBooks) + "&totald=" + CStr(intNumDiagBooks) + "', null,
windowOptions);"
Page.RegisterStartupScript("SuccessScript", "<script
language='javascript'>" + strScript + "</script>")

When compiled and ran locally, the print button will envoke the Print
dialog. If I compile the same code and run it from my server the
button does nothing. Anyone know why and what I can do to fix this?

Nov 19 '05 #6
U are right :)

"Matt Berther" wrote:
Hello vinay,

This is the same idea as doing

<base target="_self"/>

albeit, much less convoluted...

--
Matt Berther
http://www.mattberther.com
try this..

<script language="javascript">
window.name = "Popup"
</script>
<form id="Form1" method="post" target="Popup" runat="server">

"Lisa" wrote:
I have an aspx page that has a print button on it. The code for the
Clicked Event of the Print button is:

Dim strScript As String
strScript = "<script language='javascript'>"
strScript += "window.print();"
strScript += "</script>"
Page.RegisterStartupScript("print", strScript)
The aspx page above is opened using the following code from another
aspx page:

strScript = "var windowOptions = 'dialogHeight: 400px; dialogWidth:
600px;
center: yes; help: no; resizable: no; status: no;'; "
strScript += "window.showModalDialog(page.aspx?v1=" + CStr(intVar1) +
"&occ=" + CStr(intVar2) + "&loc=" + CStr(intVar3) + "&total=" +
CStr(intNumBooks) + "&totald=" + CStr(intNumDiagBooks) + "', null,
windowOptions);"
Page.RegisterStartupScript("SuccessScript", "<script
language='javascript'>" + strScript + "</script>")

When compiled and ran locally, the print button will envoke the Print
dialog. If I compile the same code and run it from my server the
button does nothing. Anyone know why and what I can do to fix this?


Nov 19 '05 #7

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

Similar topics

2
by: Bjoern Obermeyer | last post by:
Hi, I am writing an application with a JFrame as the main window and several dialogs to gain user input. The problem arises when another window (from a differnent apllication) hides my...
3
by: Rod | last post by:
I have an asp.net application where some of the interaction with the user is through modal dialog windows. This works very well except for the annoying fact that the dialog window always returns...
3
by: Andrew Baker | last post by:
OK this has me perplexed, puzzled and bamboozled! I have a remoting service which I displayed a message box in. I then wondered what would happen if a client made a call to the service while the...
2
by: cassidyc | last post by:
Hi, I was wondering if anyone has come accross this issue? And if they have any solutions I have that can create new copies of itself Form1 as = new form1(); af.show(); This form can also...
2
by: Ricky K. Rasmussen | last post by:
Hi NG, We have a rather large ASP.NET application that uses popups to display various dialogs to the user. In our work we've come over a rather annoying "bug": If we open a modal dialog using...
10
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a...
1
by: wendy | last post by:
I have got a problem while using the modal dialogs. In my code I need to open a modal dialog from the parent page and I need to enter some values in the dialog and save it. It takes the values...
2
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the...
23
by: Chukkalove | last post by:
Im sorry, I dont know the correct description for a hierarchy of parent and child forms. I have a main form that opens a child form modally. This child form in turn opens it's own child form...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.