Telerik Forums
Reporting Forum
4 answers
421 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 Object, ByVal 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 Date, ByVal 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
129 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
76 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
304 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
161 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
390 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.Object, ByVal 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 Nothing) AndAlso (connSettings.ConnectionString <> Nothing) Then 
        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.Object, ByVal 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 Nothing) AndAlso (connSettings.ConnectionString <> Nothing) Then 
        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
467 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
217 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
1 answer
146 views
I am presently using the bundled Crystal Reports, but I am looking at Telerik Reporting to supplement or replace it. I have a problem with a specific report in Crystal and I wonder if the Telerik product can do a better job.

The report is a two column member directory with family members. It lists the member name, contact info, spouse, and children. I want each family group to stay together, and not break cross a column or a page. With Crystal, the family groups will not break across a page (which is good), but they will break across a column (bad). After much web searching and support ticketing, I find that this can't be done in Crystal.

Can Telerik Reporting handle this?
Ivan
Telerik team
 answered on 24 Mar 2009
1 answer
119 views
hello ,
Please any one can help me , I get this error 
An error has occured while processing Chart 'chart1':
An Unexpected error has occurred. Please review the InnerException for more information how to resolve the problem.
(happened when item doesn't have value then other choose another item get this )


this is my code


 

private void chart1_NeedDataSource(object sender, EventArgs e)

 

{

Telerik.Reporting.Processing.

Chart medicationChart = sender as Telerik.Reporting.Processing.Chart;

 

 

DateTime fromDate = Convert.ToDateTime(this.ReportParameters["StartDate"].Value);

 

 

DateTime todate = Convert.ToDateTime(this.ReportParameters["EndDate"].Value);

 

 

string country = this.ReportParameters["CountryId"].Value.ToString();

 

 

int recordCount = Convert.ToInt32(this.ReportParameters["RecordCount"].Value);

 

 

GetMedicationReportTableAdapter adapter = new GetMedicationReportTableAdapter();

 

 

dsMedication.GetMedicationReportDataTable data = adapter.GetMedicationData(fromDate, todate, country, recordCount);

 

medicationChart.DataSource = data.DefaultView;

}

 

thanks in advance


Chavdar
Telerik team
 answered on 24 Mar 2009
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?