Friday, March 16, 2012

Open another browser during processing

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.)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

"Lisa" <lisa.staples@.gnb.ca> wrote in message
news:fdc645ca.0501261053.1e7e9938@.posting.google.c om...
> 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.)
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.
Strange. onclick="window.print(); should do. Just rechecked it again. May be
you are having security problems?

Eliyahu

<lisa.staples@.gnb.ca> wrote in message
news:1106838401.284634.85080@.c13g2000cwb.googlegro ups.com...
> 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.

0 comments:

Post a Comment