views:

93

answers:

1

Hi,I have a user control that contains a reportviewer control.And I want to send an array of reportparameter to my user control.But I can't figure out how to do.I'm getting "Object reference not set to an instance of an object. ".My param_reportParam variable is null in usercontrol. Any help is appreciated.

My user control's parameter is like that ;

[Browsable(false)]
public ReportParameter[] param_reportParam
{
    get { return _param_reportParam; }
    set { _param_reportParam = value; }
}
private ReportParameter[] _param_reportParam;

And a simple page that uses user control to show server reports is like that ;

     ReportParameter[] parameters = new ReportParameter[4];//parameter number can be different
    parameters[0] = new ReportParameter("imza", imzalayacaklar);
    parameters[1] = new ReportParameter("Sayi_Son_Eki", "984");
    parameters[2] = new ReportParameter("PersonelTip", "2");
    parameters[3] = new ReportParameter("parafli", "1");
    wuc_rapor_genel1.param_reportParam = parameters;//this is my usercontrol
+1  A: 

Looks like you need to do it in the set accessor of your property. Something like this:

set
{ 
    _param_reportParam = value; 

    MyReportViewer.ServerReport.SetParameters(_param_reportParam);
}
Henrik Söderlund
thanks for your response,I have been doing it,sorry I didn't write it in my explanation.My problem is my reportparameter array is null in user control.
slayer35