R
ruca
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.ImageClickEventArgs) Handles ibtnPrint.Click
Try
myFunction() 'do the job before print
Dim sbScript As New System.Text.StringBuilder
sbScript.Append("<script language='javascript'>")
sbScript.Append(Environment.NewLine)
sbScript.Append("window.print();")
sbScript.Append(Environment.NewLine)
sbScript.Append("</script>")
RegisterClientScriptBlock("OpenImp", sbScript.ToString())
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.print(), but this will print
me a blank page.
If I put in Page Load this piece of code ibtnPrint.Attributes.Add("OnClick",
"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.ImageClickEventArgs) Handles ibtnPrint.Click
Try
myFunction() 'do the job before print
Dim sbScript As New System.Text.StringBuilder
sbScript.Append("<script language='javascript'>")
sbScript.Append(Environment.NewLine)
sbScript.Append("window.print();")
sbScript.Append(Environment.NewLine)
sbScript.Append("</script>")
RegisterClientScriptBlock("OpenImp", sbScript.ToString())
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.print(), but this will print
me a blank page.
If I put in Page Load this piece of code ibtnPrint.Attributes.Add("OnClick",
"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