public
int _filteredCount = 0;
private void textBox1_ItemDataBinding(object sender, EventArgs e)
{
_filteredCount += 1;
}
The intent here is to count how many rows will be added based on the filter. This seems to work fine and _filteredCount is set correctly based on the data that I supply to it.
In SummaryCategoryMaster, I have added the following event handler:
private void astCatDetailSubreport_ItemDataBound(object sender, EventArgs e)
{
SummaryCategoryDetail detailReport = (SummaryCategoryDetail)this.astCatDetailSubreport.ReportSource;
if (detailReport != null)
{
this.Visible = detailReport._filteredCount > 0;
detailReport._filteredCount = 0;
}
}
The intent is for the SummaryCategoryMaster subreport to not display if it's subreport has no data. When I run the code and display the report in a ReportViewer on a WinForm, however, the SummaryCategoryMaster appears no matter what the value to this.Visible is set to. When I save the generated report as a PDF, however, the SummaryCategoryMaster does not appear. I'm using the 430 version of 2009.
What am I doing wrong and is there a better way for me to do this?
Thanks in advance.
| private void chart1_NeedDataSource(object sender, EventArgs e) |
| { |
| Telerik.Reporting.Processing.Chart chart = sender as Telerik.Reporting.Processing.Chart; |
| chart.DataSource = this.richPlayDBDataSetTableAdapter1.GetData(Convert.ToString(chart.Report.Parameters["SSN"])); |
| DataRowView row = (DataRowView)chart.DataItem; |
| Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)chart.ItemDefinition; |
| defChart.Series[0].DefaultLabelValue = string.Format("{0} #%", row["Fund"]); |
| } |
Partial Public Class DAReport
Inherits Telerik.Reporting.Report
Public Sub New(ByVal InvoiceID as integer)
InitializeComponent()
ShowInfo(InvoiceID)
End Sub
Sub ShowInfo(ByVal InvoiceID as integer)
Dim oView As System.Data.DataView = Nothing
Dim strQuery As String = "select * from invoice_lineItems where invid="& InvoiceID
Table1.DataSource = getDataSet(strQuery, "invoice_lineItems")
Table1.DataMember = "da_invoice_lineitems"
End Sub
Public Function getDataSet(ByVal strQuery As String, ByVal strTbl As String) As System.Data.DataSet
Dim ds As System.Data.DataSet = New DataSet
Try
Dim da As New MySqlDataAdapter
Dim bind As New BindingSource
Dim strConn As String = ConfigurationManager.AppSettings("ConnectionString")
Dim objConn As MySqlConnection = New MySqlConnection(strConn)
objConn.Open()
da = New MySqlDataAdapter(strQuery, objConn)
da.FillSchema(ds, SchemaType.Source, strTbl)
da.Fill(ds, strTbl)
objConn.Close()
Return ds
Catch ex As Exception
Return ds
End Try
End Function
End Class