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

programatically setting datasouce by NeedDatasouce event only generate a empty spreadsheet

2 Answers 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Qixiong Zhen
Top achievements
Rank 1
Qixiong Zhen asked on 07 Feb 2010, 11:37 PM
Hi, telerik team,
I drag table control with 3 column  to a report and set the NeedDataSource event as:
 private void MonthTable_NeedDataSource(object sender, EventArgs e)
        {
           (sender as Telerik.Reporting.Processing.Table).DataSource = GetDataSource();

        }

         DataTable GetDataSource()
        {
            DataTable tablelocal = new DataTable();
            tablelocal.Columns.Add("Value", System.Type.GetType("System.Int32"));
            tablelocal.Columns.Add("LabelA", System.Type.GetType("System.String"));
            tablelocal.Columns.Add("LabelB", System.Type.GetType("System.String"));
            
            tablelocal.Rows.Add(new object[] { 5, "Item 1", "A" });
            tablelocal.Rows.Add(new object[] { 4, "Item 2", "B" });
            tablelocal.Rows.Add(new object[] { 3, "Item 3", "C" });
            tablelocal.Rows.Add(new object[] { 2, "Item 4", "D" });
            tablelocal.Rows.Add(new object[] { 1, "Item 5", "E" });
            return tablelocal;
        }
       
The generated report is only a empty spreadsheet  with 3 column and 5 rows(not include the head).
Do you have any advice so that I can see the real table data in the spreadsheet?

Thanks a lot!

Qixiong


2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 08 Feb 2010, 08:40 AM
Hi Qixiong Zhen,

Please check that you have set the fields accordingly like in the attached screenshot.

Kind regards,
Steve
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Qixiong Zhen
Top achievements
Rank 1
answered on 09 Feb 2010, 02:57 AM
That is what caused the spreadsheet data not being seen.
Thanks a lot!
Qixiong
Tags
General Discussions
Asked by
Qixiong Zhen
Top achievements
Rank 1
Answers by
Steve
Telerik team
Qixiong Zhen
Top achievements
Rank 1
Share this question
or