views:

384

answers:

1

I have 4 reports Report A, Report B, Report C and Report D with datasources dsA, dsB, dsC and dsD respectively.

Report A is a Main Report which has the subreport B has a subreport C ...

The Report A fills the datasource dsB in the SubreportProcessingEvent with the parameter from ReportA.

i would need an event which is fired for every row in Report B so that I pass parameter from Report B and fill the Report C and C parameter to Report D....

code in SubreportProcessingEventArg

    SearchValue = new SqlParameter[2];
    SqlConnection thisConnection = new SqlConnection(thisConnectionString);
    DataSet thisDataSet = new DataSet();
    SearchValue[0] = new SqlParameter("@TPlanId", e.Parameters[1].Values[0]);
    SearchValue[1] = new SqlParameter("@ProblemId", e.Parameters[0].Values[0]);

    thisDataSet = SqlHelper.ExecuteDataset(thisConnection, "Proc_TP_Goal", SearchValue);

    /* Associate thisDataSet  (now loaded with the stored procedure result) with the  ReportViewer datasource */
    ReportDataSource datasource = new ReportDataSource("Goal_Proc_TP_Goal", thisDataSet.Tables[0]);
    e.DataSources.Add(datasource);

i was not able to figure out the 3rd and 4th level of event handler any suggestion or examples would be greatly appreciated.

Thanks

A: 

I do this, I have a parameter in the sub-subreports that pass the row of the subreport. I hope you understand, if not let me know and I will post a sourcecode.

  if ("RendicionDetalleCodigosReporte".Equals(e.ReportPath))
        {
            if (data != null)
            {
                RendicionDetalleData detalle = new RendicionDetalleData();
                detalle.row = 0;
                int row = Convert.ToInt32(e.Parameters[0].Values[0]);
                foreach (var det in data.Detalles)
                {
                    if (det.row.Equals(row))
                    {
                        detalle = det;
                        break;
                    }

                }

                if (detalle.row == 0)
                {
                    e.DataSources.Add(new ReportDataSource("RendicionDetalleCodigo", new List<RendicionDetalleCodigosData>()));
                }
                else
                {
                    e.DataSources.Add(new ReportDataSource("RendicionDetalleCodigo", detalle.Codigos));
                }
            }
            else
            {
                e.DataSources.Add(new ReportDataSource("RendicionDetalleCodigo", new List<RendicionDetalleCodigosData>()));
            }
        }
        else
        {
            if (data != null)
            {
                e.DataSources.Add(new ReportDataSource("RendicionDetalle", data.Detalles));

            }
            else
            {
                e.DataSources.Add(new ReportDataSource("RendicionDetalle", new List<RendicionDetalleData>()));
            }
        }
Jedi Master Spooky
Thanks for posting! this was a while ago i have posted and i have already implemented a work around for this, it would be nice if you post the source code for future reference.
vinod

related questions