This is a migrated thread and some comments may be shown as answers.

Help urgently needed

4 Answers 238 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sidney smith
Top achievements
Rank 1
sidney smith asked on 31 Aug 2007, 02:19 PM
I need help figuring out why the following code does not work:

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;  
    } 

4 Answers, 1 is accepted

Sort by
0
Chavdar
Telerik team
answered on 31 Aug 2007, 04:00 PM
Hi Sidney,

Most probably the problem is because you don't set the Location and Size properties for the dynamically created textboxes. Assure that when created the textboxes have reasonable locations and sizes. It is especially important for the Html rendering as it doesn't allow overlapping of report items.

Kind regards,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
sidney smith
Top achievements
Rank 1
answered on 04 Sep 2007, 02:24 PM
Ok tried your tip, no results.  On a size note, on the web side, tehre is no "size" property, but I did use width, same thing no results.
0
sidney smith
Top achievements
Rank 1
answered on 04 Sep 2007, 02:24 PM
Ok tried your tip, no results.  On a size note, on the web side, tehre is no "size" property, but I did use width, same thing no results.
0
Chavdar
Telerik team
answered on 04 Sep 2007, 04:33 PM
Hi Sidney,

I'm attaching a sample web site solution. Give it a try and let me know if there are still problems.

 
Kind regards,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
sidney smith
Top achievements
Rank 1
Answers by
Chavdar
Telerik team
sidney smith
Top achievements
Rank 1
Share this question
or