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?
| 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 |
| 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 |
|
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 |
Hello ,
Please any one can help me , I made Report in telerik reporting with 4 report parameters 2 datetime , 1 integer , 1 string , inside this report I put subreport with same parameter because main report for chart and subreport for display date , first
NeedDataSource fired true but second NeedDataSource have error Error converting data type nvarchar to datetime sql exception was unhandled by user code
thanks in advace