Passing parameter to sub report from main report.Getting error Value cannot be null RRS feed

  • Question

  • Hi all,

    I m RDLC in visual studio 2010 and designed reports.

    But when I created a subreport and embeded it in main report.

    reportviewer placed on page required parameters of sub report I donot know how pass parameter thr??

    then I set all the code in code behind.But i m getting following error

    An error occurred during local report processing. Value cannot be null. Parameter name: value

    I have used the following method function filldata is called on page load.

    public void fiildata()
                ObjectDataSource ObjectDataSource1 = new ObjectDataSource();
                ObjectDataSource1.SelectMethod = "GetData";
                ObjectDataSource1.TypeName = "ds_AllUserListTableAdapters.USP_All_UserlistTableAdapter";           
                ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsUserlist", ObjectDataSource1));

                ReportViewer1.LocalReport.ReportPath = "Reports/Rpt_AllUserlist.rdlc";
                ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubReportHandel);


     void SubReportHandel(object sender, SubreportProcessingEventArgs e)

                string id = e.Parameters[0].Values[0];
                ObjectDataSource ObjectDataSource2 = new ObjectDataSource();
                ObjectDataSource2.SelectMethod = "GetData";
                ObjectDataSource2.TypeName = "ds_UserwiseAlertsTableAdapters.USP_AlertTypeLog_UesrWiseTableAdapter";//
                ObjectDataSource2.SelectParameters.Add("UserID", System.Data.DbType.Int64, e.Parameters[0].Values[0]);
                e.DataSources.Add(new ReportDataSource(" dsuserwisealerts", ObjectDataSource2));

    Any help would be appreciated..

    • Moved by Eason_H Tuesday, December 10, 2013 1:40 AM
    Monday, December 9, 2013 10:47 AM

All replies