M
Marc Callec
I'm trying to create an instance of the CrystalReportViewer control
within my class in an attempt to return the rendered HTML back to the
consumer of the class. Because I haven't added the
CrystalReportViewer control directly to a web page, but have
instantiated in manually I've explicitly called the OnLoad, OnInt,
OnPreRender and OnUnload in an attempt to get the control to be
initialised correctly.
Dim stringWrite As New System.IO.StringWriter
Dim htmlWrite As New
System.Web.UI.HtmlTextWriter(stringWrite)
MyBase.OnInit(e)
MyBase.ReportSource = "C:\Sample2.rpt"
MyBase.OnLoad(e)
MyBase.Render(htmlWrite)
MyBase.OnPreRender(e)
MyBase.OnUnload(e)
return stringWrite.ToString
The returned HTML renders the Crystal toolbar and the area where the
report should be is yellow and includes the text - CrystalViewer
Error: Object reference not set to an instance of an object.
So, it looks like there is still something I need to set in the
control, but I don't have any idea what that might be. I'm thinking
it may be viewstate or the page context - something that ASP.Net would
usually set up for the control.
FYI - I'm not using the ReportDocument object to export the HTML
becuause I need to have the ability to drill down, which the export
function doesn't do.
Does anyone have any ideas or suggestions for manually setting up the
CrystalReportViewer control correctly? I've spent a few days trying
to get this to work, so I'm getting a little frustrated at the moment.
within my class in an attempt to return the rendered HTML back to the
consumer of the class. Because I haven't added the
CrystalReportViewer control directly to a web page, but have
instantiated in manually I've explicitly called the OnLoad, OnInt,
OnPreRender and OnUnload in an attempt to get the control to be
initialised correctly.
Dim stringWrite As New System.IO.StringWriter
Dim htmlWrite As New
System.Web.UI.HtmlTextWriter(stringWrite)
MyBase.OnInit(e)
MyBase.ReportSource = "C:\Sample2.rpt"
MyBase.OnLoad(e)
MyBase.Render(htmlWrite)
MyBase.OnPreRender(e)
MyBase.OnUnload(e)
return stringWrite.ToString
The returned HTML renders the Crystal toolbar and the area where the
report should be is yellow and includes the text - CrystalViewer
Error: Object reference not set to an instance of an object.
So, it looks like there is still something I need to set in the
control, but I don't have any idea what that might be. I'm thinking
it may be viewstate or the page context - something that ASP.Net would
usually set up for the control.
FYI - I'm not using the ReportDocument object to export the HTML
becuause I need to have the ability to drill down, which the export
function doesn't do.
Does anyone have any ideas or suggestions for manually setting up the
CrystalReportViewer control correctly? I've spent a few days trying
to get this to work, so I'm getting a little frustrated at the moment.