On this line, not just divisionList
can be null
, and in fact, in this case, it would be fine.
divisionTotalsReport.ReportParameters["list"].Value = divisionList
As the NullReferenceException
exception only normally occurs when trying to dereference an object, the candidates are:
divisionTotalsReport
divisionTotalsReport.ReportParameters
divisionTotalsReport.ReportParameters["list"]
If you've confirmed that divisionTotalsReport
is set and that ReportParameters
is returning a valid reference, then it is most likely that it just doesn't have a list
item.
You don't show what initialises DivisionReport
but if it's loaded from a report file, you may need to add the list
parameter before you can set it.