I am using VS2005 (without SP1) and have the following problem.
I have a page that is using report viewer and need to use a number of different report definitions. Because I have not got SP1 installed I can't use the ReportViewer.Reset() method so am getting around this the following way...
ControlCollection coll = ReportViewer1.Parent.Contr
ols;
int oldReportIndex = coll.IndexOf(ReportViewer1
);
coll.Remove(ReportViewer1)
;
coll.AddAt(oldReportIndex,
newReportViewer);
This works almost all of the time, however, occasionally I get the "Object reference not set to an instance of an object" on the "ControlCollection coll = ReportViewer1.Parent.Contr
ols" line. I am guessing that it is because the ReportViewer1.Parent.Contr
ols is null....
Does anyone have a nice way of getting around this problem?
Any help on this would be appreciated
Thanks in advance
Start Free Trial