This is a migrated thread and some comments may be shown as answers.

Subreport and a field not filled when printing / exporting

4 Answers 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 16 Sep 2011, 04:10 PM
Hello Telerik,
I'm using 5.1.11.713, and I'm developing a new report, when I print or export it I don't see a subreport (and a field filled with .Value property)
If I set UseNativePrinting to true it prints it....
the only strange thing I'm doing is so :

if (tipoLegame != -1)
         {
             switch (tipoLegame)
             {
                 case 0:
                     subReportAnagrafica.ReportSource = new SubPersonaFisica();
                     break;
                 case 1:
                     subReportAnagrafica.ReportSource = new SubPersonaGiurica();
                     break;
                 case 2:
                     subReportAnagrafica.ReportSource = new SubSCO();
                     break;
             }
 
             subReportAnagrafica.ReportSource.DataSource = dettagli;
             SetField(dettagli.Field);
 
             var risultatoDomande = reportFactory.GetListaDomandeRisposteUtente(IDUtente, IDQuestionario);
             this.table1.DataSource = risultatoDomande;

Any suggestion? I'm calling it from silverlight

...
 
  public ReportGen(int idQuestionario,int idCliente)
        {
            InitializeComponent();
 
            this.IDQuestionario = idQuestionario;
            this.IDCliente = idCliente;
 
            reportViewer.ReportServiceClientFactory = this;
            reportViewer.Report = myreport;
 
            if (CanUserExportToExcel())
            {
 
                btnEsporta.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                btnEsporta.Visibility = System.Windows.Visibility.Collapsed;
            }
 
            this.reportViewer.RenderBegin += new RenderBeginEventHandler(reportViewer_RenderBegin);
            this.Closed += new EventHandler<WindowClosedEventArgs>(DettaglioReportCliente_Closed);
        }
 
    private void reportViewer_RenderBegin(object sender, RenderBeginEventArgs args)
        {
            args.ParameterValues[STR_PARAM_QUESTIONARIO] = IDQuestionario;
            args.ParameterValues[STR_PARAM_IDUSER] = App.UtenteLoggato.IDInterno;
            args.ParameterValues[STR_PARAM_IDCLIENTE] = IDCliente;
        }

4 Answers, 1 is accepted

Sort by
0
Michele
Top achievements
Rank 2
answered on 21 Sep 2011, 08:42 AM
anyone can help me on this?
0
Steve
Telerik team
answered on 21 Sep 2011, 03:52 PM
Hi Paolo,

One thing that we notice is wrong in this code, is that you use the definition table item probably in an event. However in the context of event you should always use the processing item. For more information refer to Understanding Events help article.

Regards,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Michele
Top achievements
Rank 2
answered on 22 Sep 2011, 07:33 AM
Hello Steve,
yes I'm using it on
  void xxx_NeedDataSource(object sender, EventArgs e)
        {
}

 

How can I cast the processing item to my report in order to set the subReport to the type I need?

Thanks

 

0
Steve
Telerik team
answered on 27 Sep 2011, 05:08 PM
Hello Paolo,

It is not correct to use the report NeedDataSource event to specify data source for table or specify ReportSource for SubReports. This event is fired only once when the report has no datasource set and it would not be fired second time upon operations such as print or export. So in this line of thoughts it is strange that it works with True print at all.
Try using the ItemDataBinding event instead of NeedDataSource or use Bindings and User Functions instead i.e. set Binding for the ReportSource property to an user function that contains your code/logic to switch the report source.

If you're still having problems, it would be best to open a support ticket and provide us with a runnable sample that exhibits the problem.

All the best,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
Michele
Top achievements
Rank 2
Answers by
Michele
Top achievements
Rank 2
Steve
Telerik team
Share this question
or