Telerik Forums
Reporting Forum
7 answers
625 views
Hi

I have a bunch of reports that are added to a Reportbook as follows:

 ReportBook reportBook = new ReportBook();
 reportBook.Reports.Add(report1);
reportBook.Reports.Add(report2);
reportBook.Reports.Add(report3);
...

I then assign reportbook to my ReportViewer1 control as follows:

 ReportViewer1.Report = reportBook;
        ReportViewer1.Report.DocumentName = "some name";
        ReportViewer1.DataBind();

The question is how to display the report book programmatically in the ReportViewer control?

A sample project or code snippet would be helpfull.

Thanks

Peter
Chavdar
Telerik team
 answered on 30 Mar 2009
3 answers
134 views
Hi
     I have a group in my report, and i set a pagebreak after the groupfooter. There is a problem that i get a blank page after all the pages generated, because of the pagebreak i set in the groupfooter.How to fix it?
    Thanks.
Hrisi
Telerik team
 answered on 30 Mar 2009
4 answers
379 views
Hi I have an asp .net application, on my page is a reportviewer, I also have created a report (rptSummary)

below is the Page_load event of my page

 

 

 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        If Me.IsPostBack Then 
 
 
            If Me.RadDatePickerStartDate.SelectedDate.HasValue = True And Me.RadDatePickerEndDate.SelectedDate.HasValue = True Then 
 
                Dim newrpt As New rptSummary(CDate(Me.RadDatePickerStartDate.SelectedDate.Value), CDate(Me.RadDatePickerEndDate.SelectedDate.Value))  
                Me.ReportViewer1.Report = newrpt  
 

                Response.Write(

CType(CType(Me.ReportViewer1.Report, rptSummary).DataSource, svcDailyStats.clsDailyStatistics).intTotalCalls)

 

 

            End If 
        End If 
 
 
    End Sub 


 And here we see some code from my report

 

Imports System.ComponentModel  
Imports System.Drawing  
Imports System.Windows.Forms  
Imports Telerik.Reporting  
Imports Telerik.Reporting.Drawing  
 
Partial Public Class rptSummary  
    Inherits Telerik.Reporting.Report  
 
    Private objDailyStats As svcDailyStats.DailyStats  
    Private DailyStats As svcDailyStats.clsDailyStatistics  
 
    Public Sub New()  
        InitializeComponent()  
        objDailyStats = New svcDailyStats.DailyStats  
        DailyStats = objDailyStats.GetDailyStatsEmpty()  
        Me.DataSource = DailyStats  
    End Sub 
 
    Public Sub New(ByVal startDate As DateByVal enddate As Date)  
 
 
        InitializeComponent()  
 
        objDailyStats = New svcDailyStats.DailyStats  
        DailyStats = objDailyStats.GetDailyStats(startDate, enddate)  
        Me.DataSource = DailyStats  
 
 
    End Sub 
End Class 

Now as an example lets assume I submit my page with the values of RadDatePickerStartDate = '01/03/2009' and RadDatePickerEndDate = '02/03/2009'

The report runs, the datasource is set with the newly created business object using these 2 dates as expected.

Now lets suppose I change those 2 dates and submit the page again, for some reason the report doesn't change. You'll see the response.write in the above code, intTotalCalls is a property of my business object that I am setting as a datasource for my report. This value will change and display on my page as expected for the response.write but it will not change in my visible report and always remains the same as the first time the report was run as do all other fields in the report.

 

DGraham
Top achievements
Rank 1
 answered on 26 Mar 2009
3 answers
84 views
Hi..
          Sir I have created a hirarical tre view using a sqldatasource., like the following one...

Main
--> Group1
------>Child 1 g1
------>Child 2 g1
-->Group2
------>Child 1 g2
------>Child 2 g2

Now doubt is... i need to add a new node for Child 1 g2 by entering the text by clicking the node., then i expect the
following treeview..

Main
--> Group1
------>Child 1 g1
------>Child 2 g1
-->Group2
------>Child 1 g2
----------> Child 1 g2 1
------>Child 2 g2
.. i am waiting for ur reply...
By
Suriya

Peter
Telerik team
 answered on 26 Mar 2009
1 answer
54 views
I upgraded to version 2.9.9.202 from 2.9.8.1105 and now the colors on my report are very dim compared to the bright colors that I previously had.  I am using generic Red, Light Green, and Yellow.  Has anyone else seen this?
Svetoslav
Telerik team
 answered on 26 Mar 2009
1 answer
279 views
Hi,

I  create a subreport in the detail by passing display ID as below:

  private void detail_ItemDataBound(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.DetailSection section = sender as Telerik.Reporting.Processing.DetailSection;
            DataRowView row = section.DataItem as DataRowView;
            object ID = row.Row["ID"];

            if ((row["ID"] != null) && (row["ID"].ToString().Length != 0))
            {
                              
                //pass parameter- ID, date from & date to
                this.subDrivingLicense.ReportSource = new rptDriverReminderSub1();
                this.subDrivingLicense.ReportSource.DataSource = blDrivingLicense.ListRecords(ID.ToInt(), strDateFrom, strDateTo);

            }                          
        }

but sub report always show "the expression contains object "ExpiryDate" that is not defined in the current context".

What should i do to fix it?anything i miss out?

Ivan
Telerik team
 answered on 26 Mar 2009
1 answer
125 views
Hi :
     All the reports export  to pdf format,where has a cumbrous blank page which only have pagehead and pagefoot follow the last page.
thx
chen
Hrisi
Telerik team
 answered on 25 Mar 2009
1 answer
330 views
Hello,

I tried to pass a parameter to a subreport with a NeedDataSource event handler.
The subreport uses a generated DataSet, say SubReportDataSet.xsd, and there is an SQL parameter @Parameter in the SelectCommand.

When I tried the below error example code, I could only get the message rendered to the subreport:
 "The expression contains object '####' that is not defined in the current context. "
,where the object '####' refers to a first data expression in the report surface, like =Fields.FirstField

I checked that the NeedDataSource runs and It fills the dataset correctly. I tried to put the event handler to the subreport or the main report, with no difference in the result.

Eventually, I fixed the report by creating a new SqlAdapter (working example below).

I just wonder if this is a bug? I use Q1 2009 (3.0.9.311).

Strangely, a generated adapter works fine as a CrossTab datasource. Adapter connection string and parameters are set up in a NeedDataSource event. I have a CrossTab embedded in an othewise empty subreport and I fill the DataSet just like in the error example. Except that I don't have to dynamically set a datasource anywhere.

Regards,
-mika-

UPDATED: The answer was right, the DataSource in the error example should be set:
report.DataSource = Me.SubReport1DataSet.SubReport1DataSetTable


Error example:
Private Sub SubReport1_NeedDataSource(ByVal sender As System.ObjectByVal e As System.EventArgs) _ 
        Handles MyBase.NeedDataSource 
 
    'Take the Telerik.Reporting.Processing.Report instance  
    Dim report As Telerik.Reporting.Processing.Report = CType(sender, Telerik.Reporting.Processing.Report) 
 
    ' Read connection string from app.config / web.config 
    Dim connSettings As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("SiteSqlServer"
 
    If (connSettings IsNot NothingAndAlso (connSettings.ConnectionString <> NothingThen 
        Me.SubReport1DataSetTableAdapter1.Connection.ConnectionString = connSettings.ConnectionString 
 
        'ReportParameter value to SQL 
        Dim param As Integer = report.Parameters("Parameter"
        Me.SubReport1DataSetTableAdapter1.Fill(Me.SubReport1DataSet.SubReport1DataSetTable, param) 
 
        ' Set report data source 
        report.DataSource = Me.SubReport1DataSetTableAdapter1 
 
    End If 
 
End Sub 

Working example:
Private Sub SubReport1_NeedDataSource(ByVal sender As System.ObjectByVal e As System.EventArgs) _ 
        Handles MyBase.NeedDataSource 
 
    'Take the Telerik.Reporting.Processing.Report instance  
    Dim report As Telerik.Reporting.Processing.Report = CType(sender, Telerik.Reporting.Processing.Report) 
 
    ' Read connection string from app.config / web.config 
    Dim connSettings As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("SiteSqlServer"
     
    If (connSettings IsNot NothingAndAlso (connSettings.ConnectionString <> NothingThen 
        Dim conn As SqlConnection = New SqlConnection(connSettings.ConnectionString) 
        Dim commandText As String = "SELECT ... WHERE id = @Parameter" 
        Dim cmd As New SqlCommand(commandText, conn) 
 
        'ReportParameter value to SQL 
        Dim param As Integer = report.Parameters("Parameter"
        cmd.Parameters.Add("@Parameter", SqlDbType.VarChar, 10).Value = param 
 
        Dim adapter As New SqlDataAdapter(cmd) 
 
        Dim ds As New DataSet() 
        adapter.Fill(ds) 
        report.DataSource = adapter 
 
    End If 
 
End Sub 

Ivan
Telerik team
 answered on 25 Mar 2009
6 answers
420 views
I'm using VS2008 with 2009-Q1 reporting.  The reporting menu is missing.  How do I get it to appear? 
John W Wilson
Top achievements
Rank 1
 answered on 25 Mar 2009
4 answers
195 views
Hi all,
    I have a problem with reporting, when I export to any(like excel, PDF,CSV,etc.), it will be 2 pages, and if there is a chart, it will be print 2 times of this chart. I don't konw why? If you have any ideas, Please let me know.
    Additionally, I have advanced a problem a.m. Please help with it. It also about chart, when export to excel, the chart does not display. I have no idea about this.

Thanks ,

BestRegards,
Rain 
Rain
Top achievements
Rank 1
 answered on 25 Mar 2009
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?