views:

403

answers:

2

Hey everyone,

I have a report that takes two parameters from a couple of text boxes that always ends up being null when passed to the stored proc. Here is the code. Also I stepped through the code and the passed in parameters have values but between passing in the params to when the proc is executed it becomes null.

     protected void btnSearch_Click(object sender, EventArgs e)
     {
            pnlRecords.Visible = true;

            ReportParameter p1 = new ReportParameter("DateStart", ReportDates1.DateStart);
            ReportParameter p2 = new ReportParameter("DateEnd", ReportDates1.DateEnd);

            this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2 });
            this.ReportViewer1.LocalReport.Refresh();
     }

What do you think?

A: 

I figured it out. Here is what I was missing in the .cs file

ObjectDataSource1.SelectParameters[0].DefaultValue = ReportDates1.DateStart;
ObjectDataSource1.SelectParameters[1].DefaultValue = ReportDates1.DateEnd;
ObjectDataSource1.DataBind();
chopps
A: 

hi, What is ObjectDataSource1? Are you using a rdl or a rdlc report?