| | |
Load image in report in runtime in ASP.Net
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 3
Reputation:
Solved Threads: 0
Hi,
I have to display a logo in crystal report in runtime. I have tried two solutions given in http://www.devx.com/codemag/Article/33658/1954 (Tip 6: Better Handling of Dynamic Images)
Dim data As New DataSet()
Dim row As DataRow
Step1 (Passing Image URL into dataset): my code is as follows
--------------
Step2 (Storing Image into dataset): my code is as follows
--------
In both case i am getting error "cannot obtain value" in following line:
rptDoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, False, "")
Need help to solve this. Its very urgent.
Thanks
I have to display a logo in crystal report in runtime. I have tried two solutions given in http://www.devx.com/codemag/Article/33658/1954 (Tip 6: Better Handling of Dynamic Images)
Dim data As New DataSet()
Dim row As DataRow
Step1 (Passing Image URL into dataset): my code is as follows
asp.net Syntax (Toggle Plain Text)
Private Sub LoadImgUrl() Try data.Tables.Add("Image") data.Tables("Image").Columns.Add("Name") row = data.Tables(0).NewRow() row(0) = Server.MapPath("DI.bmp") data.Tables(0).Rows.Add(row) rptDoc.Load(Server.MapPath("rptImgUrl.rpt")) rptDoc.SetDataSource(data) Response.Clear() Response.Buffer = True Response.ClearContent() Response.ClearHeaders() Response.ContentType = "application/pdf" rptDoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, False, "") Response.Flush() Response.End() Catch ex As Exception End Try End Sub
Step2 (Storing Image into dataset): my code is as follows
asp.net Syntax (Toggle Plain Text)
Private Sub LoadImgDS() Try data.Tables.Add("Image") data.Tables("Image").Columns.Add("Logo", System.Type.GetType("System.Byte[]")) Dim fs As New System.IO.FileStream(Server.MapPath("DI.bmp"), System.IO.FileMode.Open, IO.FileAccess.Read) Dim br As New System.IO.BinaryReader(fs) row = data.Tables("Image").NewRow() row("Logo") = br.ReadBytes(br.BaseStream.Length) data.Tables("Image").Rows.Add(row) rptDoc.Load(Server.MapPath("rptImgDS.rpt")) rptDoc.SetDataSource(data) Response.Clear() Response.Buffer = True Response.ClearContent() Response.ClearHeaders() Response.ContentType = "application/pdf" rptDoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, False, "") br.Close() fs.Close() br = Nothing fs = Nothing Catch ex As Exception End Try End Sub
In both case i am getting error "cannot obtain value" in following line:
rptDoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, False, "")
Need help to solve this. Its very urgent.
Thanks
Last edited by peter_budo; Nov 12th, 2008 at 5:49 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: deleting values from the gridview
- Next Thread: create sqldatasource through coding
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox class compatible confirmationcodegeneration content contenttype countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv forms gridview gudi homeedition iis javascript jquery list listbox menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice xml xsl





