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

Problem loading report after update to Q3

1 Answer 63 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 Nov 2010, 09:53 AM
Hello,
I'm currently facing problem loading the report (using silverlight viewer) in the old way I did on Q2... I need to load the report when the user passes 2 parameters and click a button

here's my code...

private void btnCarica_Click(object sender, RoutedEventArgs e)
  {
      LoadRendiconto();
  }
 
  private void LoadRendiconto()
  {
      reportViewer.Visibility = Visibility.Visible;
      //tbErrore.Visibility = Visibility.Collapsed;
 
      if (dtPicker.IsDateValid() && ucRapporto.RapportoSelezionato != null)
      {
          reportViewer.Height = double.NaN;
          var reportViewerModel = reportViewer.DataContext as ReportViewerModel;
 
          Telerik.Reporting.Service.Parameter paramRapporto = new Telerik.Reporting.Service.Parameter();
          paramRapporto.Name = "Rapporto";
          paramRapporto.Type = typeof(int).FullName;
          paramRapporto.Value = ucRapporto.RapportoSelezionato.IDInterno;
 
          Telerik.Reporting.Service.Parameter paramData = new Telerik.Reporting.Service.Parameter();
          paramData.Name = "Data";
          paramData.Type = typeof(DateTime).FullName;
          paramData.Value = dtPicker.SelectedDate;
 
          //  parameters.Add(paramUser);
 
          if (reportViewerModel.Parameters != null)
          {
              reportViewerModel.Parameters.Add(paramRapporto);
              reportViewerModel.Parameters.Add(paramData);
          }
          // if (reportViewerModel.ApplyReportParametersCommand.CanExecute(null))
          reportViewerModel.ApplyReportParametersCommand.CanExecute(null);
 
          //if (!IsFromHistory)
          //    AddItemToHistory();
 
          SetHeader();
      }
      //else
      //{
      //    reportViewer.Visibility = Visibility.Collapsed;
 
      //    tbErrore.Visibility = Visibility.Visible;
      //}
  }

here's the Report Loaded event

private void Report_Loaded(object sender, RoutedEventArgs e)
      {
          this.reportViewer.RenderBegin += new RenderBeginEventHandler(reportViewer_RenderBegin);
 
          if (IsFirstLoad)
          {
              
 
              ucRapporto.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ucRapporto_PropertyChanged);
 
              if (IsFromHistory)
              {
                  ucRapporto.ForzaLostFocus();
              }
 
              SetFirstLoad(false);
          }
      }

can you please provide me a sample where when I click on a button it calls a report with 2 parameters?
Thanks..... as far as I've seen the BeginRender event is not fired when I click the button (it was done in the previous version when it calls reportViewerModel.ApplyReportParametersCommand.CanExecute(null);)

Thanks
Paolo

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 19 Nov 2010, 05:10 PM
Hi Paolo,

As we have advised in prior thread you've opened, it is wrong to instantiate Telerik.Reporting.Service.Parameter which is meant for internal usage only and honestly using it like you do would yield in unexpected results.
Anyway in the Q3 release we introduced a new bug in the Silverlight viewer, where if you have a Visible report parameter that does not have a value, the report parameter area would not show at all, thus the user would not be able to select a value. We would release an internal build with fix for this early next week - sorry for the inconvenience.

Greetings,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
Michele
Top achievements
Rank 2
Answers by
Steve
Telerik team
Share this question
or