Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

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

$
0
0

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);
            ReportViewer1.DataBind();
            ReportViewer1.LocalReport.Refresh();
        }

                      

 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..


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>