I am intermediate in programming and i am getting error on print preview command in my program.
Actually i had made a website using vb.net code. and i have a DailyUpdateReport.aspx page. in that i putted one image button and on image button i putted the code below..
Expand|Select|Wrap|Line Numbers
- Private Sub ImagebuttonPP_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImagebuttonPP.Click
- Try
- Dim oStringWriter As New System.IO.StringWriter
- Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)
- 'Dim oHtmlTextWriter As New System.Xml.XmlTextWriter(oStringWriter)
- Response.Clear()
- Response.Buffer = True
- Response.ContentType = "application/pdf"
- Response.Charset = ""
- Me.EnableViewState = False
- DG1.RenderControl(oHtmlTextWriter)
- Response.Write(oStringWriter.ToString())
- Response.End()
- Catch ex As Exception
- lblErr.Visible = True
- lblErr.Text = ex.Message
- End Try
- End Sub
' File does not begin with %pdf- '
I am using a Adobe Reader 9, version 9.3.2
and Internet Explorer 8
i don't know what is the problem. and how to resolve the problem.
can anyone knows the solution than please help out.
if u r not understand anything on problem then let me know to explain.
its very urgent.
Thanks
Ishtiyaque.