Hi,
I have a button that when clicked must print the current page after doing
something in a certain function. For that I have this code:
------------------------------------------------------------------------------------------------
Private Sub ibtnPrint_Click (ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles ibtnPrint.Click
Try
myFunction() 'do the job before print
Dim sbScript As New System.Text.Str ingBuilder
sbScript.Append ("<script language='javas cript'>")
sbScript.Append (Environment.Ne wLine)
sbScript.Append ("window.print( );")
sbScript.Append (Environment.Ne wLine)
sbScript.Append ("</script>")
RegisterClientS criptBlock("Ope nImp", sbScript.ToStri ng())
Catch ex As Exception
lblMsgErro.Text = ex.Message()
End Try
End Sub
------------------------------------------------------------------------------------------------
This is not opening the print dialog. I'm using frames in application, and
already change the window.print() to top.window.prin t(), but this will print
me a blank page.
If I put in Page Load this piece of code ibtnPrint.Attri butes.Add("OnCl ick",
"window.print() ;") then dialog opens ok. The problem is how can I do the job
that is doing in myFuncion method.
How can I resolve this?!?!?!?!?!? !?!?!?
I have another question: Can I change in code the header and footer of the
page that I'm printing? How?
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope can help (if I try to help)
ruca
I have a button that when clicked must print the current page after doing
something in a certain function. For that I have this code:
------------------------------------------------------------------------------------------------
Private Sub ibtnPrint_Click (ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles ibtnPrint.Click
Try
myFunction() 'do the job before print
Dim sbScript As New System.Text.Str ingBuilder
sbScript.Append ("<script language='javas cript'>")
sbScript.Append (Environment.Ne wLine)
sbScript.Append ("window.print( );")
sbScript.Append (Environment.Ne wLine)
sbScript.Append ("</script>")
RegisterClientS criptBlock("Ope nImp", sbScript.ToStri ng())
Catch ex As Exception
lblMsgErro.Text = ex.Message()
End Try
End Sub
------------------------------------------------------------------------------------------------
This is not opening the print dialog. I'm using frames in application, and
already change the window.print() to top.window.prin t(), but this will print
me a blank page.
If I put in Page Load this piece of code ibtnPrint.Attri butes.Add("OnCl ick",
"window.print() ;") then dialog opens ok. The problem is how can I do the job
that is doing in myFuncion method.
How can I resolve this?!?!?!?!?!? !?!?!?
I have another question: Can I change in code the header and footer of the
page that I'm printing? How?
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope can help (if I try to help)
ruca
Comment