Open another browser during processing

L

Lisa

If anyone knows how I could go about doing the following, I would
greatly appreciate some info.

I have an aspx page that has some fields for user input as well as a
button. When the button is clicked, the data that was entered by the
user is saved to the database. If the save is completed sucessfully,
the user would like to have a seperate browser window open and display
a receipt. This window will also have to have a print and a close
button.

The data is being saved in the clicked event of the button in the
aspx.vb page.

I've tried using a modaldialog, but it would not allow the print
function to be used.

Im not really sure how to go about using the
Page.RegisterStartupScript method. Ive tried to use it and I think
that my syntax is correct, I just dont know where to use it (Clicked
event, page load etc.)
 
E

Eliyahu Goldin

You can print from a modal dialog if you place an html button an do
window.print() in onclick event handler. The only thing you can't get is
print preview.

Eliyahu
 
L

lisa.staples

Ive actually tried that and it didn't work at all.

<INPUT id="cmdPrint" type="button" value="Print"
onclick="window.print();">

it does not seem to work. When I click the print button, nothing
happens.

I have also tried the following:

object in HTML:

<asp:Button id="cmdPrint" runat="server" Text="Print">

Code in page behind:

Private Sub cmdPrint_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmdPrint.Click
Dim strScript As String
strScript = "<script language='javascript'>"
strScript += "window.print();"
strScript += "</script>"

Page.RegisterStartupScript("print", strScript)

End Sub

This works on my local PC, but not on our server. I thought that it
might have something to do with McAfee, so I asked if it could be
turned off. It didn't make any difference.
 
E

Eliyahu Goldin

Strange. onclick="window.print(); should do. Just rechecked it again. May be
you are having security problems?

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top