I need help figuring out why the following code does not work:
I eventually get an out of memory exception on this:
But if I use:
It works, except nothing is displayed! I get no data in the report (should be over 3,00 hits...) So what the heck am I missing? It should be a fairly straight forward deal. I take a bunch of data, put it in a datatable, and then try to greate a dynamic multi-column report out of it...
OH!
Here is a function I missed posting..
I eventually get an out of memory exception on this:
| private void ShowReport(DataTable mydt1) |
| { |
| try |
| { |
| Report report = new Report(); |
| DetailSection detail = new DetailSection(); |
| Telerik.Reporting.ReportItemBase[] mylist = new ReportItemBase[mydt1.Columns.Count]; |
| int icol = 0; |
| foreach (DataColumn col in mydt1.Columns) |
| { |
| mylist[icol] = createtextbox(col.ColumnName.ToString()); |
| icol++; |
| //detail.ColumnCount++; |
| } |
| detail.Items.AddRange(mylist); |
| report.DataMember = "HIPAAlog"; |
| report.DataSource = mydt1; |
| report.Items.Add((ReportItemBase)detail); |
| detail.KeepTogether = false; |
| ReportViewer1.Report = report; |
| ReportViewer1.Visible = true; |
| } |
| catch (Exception ex) |
| { |
| throw (ex); |
| } |
| } |
But if I use:
| private void ShowReport(DataTable mydt1) |
| { |
| try |
| { |
| Report report = new Report(); |
| //DetailSection detail = new DetailSection(); |
| //Telerik.Reporting.ReportItemBase[] mylist = new ReportItemBase[mydt1.Columns.Count]; |
| //int icol = 0; |
| //foreach (DataColumn col in mydt1.Columns) |
| //{ |
| // mylist[icol] = createtextbox(col.ColumnName.ToString()); |
| // icol++; |
| // //detail.ColumnCount++; |
| //} |
| //detail.Items.AddRange(mylist); |
| report.DataMember = "HIPAAlog"; |
| report.DataSource = mydt1; |
| //report.Items.Add((ReportItemBase)detail); |
| detail.KeepTogether = false; |
| ReportViewer1.Report = report; |
| ReportViewer1.Visible = true; |
| } |
| catch (Exception ex) |
| { |
| throw (ex); |
| } |
| } |
It works, except nothing is displayed! I get no data in the report (should be over 3,00 hits...) So what the heck am I missing? It should be a fairly straight forward deal. I take a bunch of data, put it in a datatable, and then try to greate a dynamic multi-column report out of it...
OH!
Here is a function I missed posting..
| private Telerik.Reporting.TextBox createtextbox(string FieldName) |
| { |
| Telerik.Reporting.TextBox textBox2 = new Telerik.Reporting.TextBox(); |
| textBox2.Value = "=[" + FieldName + "]"; |
| textBox2.TextWrap = false; |
| textBox2.CanGrow = true; |
| textBox2.CanShrink = true; |
| return textBox2; |
| } |