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

Populating DataTable into the Report

3 Answers 224 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
DC Alliances
Top achievements
Rank 1
DC Alliances asked on 14 Aug 2009, 05:13 AM
Hi all

I am using DataSet as datasource and within each record it has ExtendedProperty. The only way to utilise this, I have to do in ItemDataBinding event doing some manipulatation.

In detail, I have DataTable that I pass to Telerik Reporting class. I believe I need to do the manipulation on the ItemDataBinding so I register that.
Here's my DataSet looks like:

KeyUser; Weight, 705; 707; 709; 711; 713; 715; 717; 721; 723     >> FieldName
User1; 10; A; B; C; D; A; B; C; D; A; B;                                            >> Record1 
User2; 20; B; C; D; A; B; C; D; A; B; C;                                            >> Record2
User3; 30; C; D; A; B; C; D; A; B; C; D;                                            >> Record3


705; 707; 709; 711; 713; 715; 717; 721; 723 are dynamics heading which is mapped to Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10. These field name could be different depending on the query.

We put this mapping under the ExtendedProperties within DataSet that we have.

In the report designer, I set in such a way in the detail section of the report, I put name the textbox as follow:

txtbxdtlKeyUserValue
txtbxdtlWeightValue
txtbxdtlAnswer1Value
txtbxdtlAnswer2Value
txtbxdtlAnswer3Value
txtbxdtlAnswer4Value
txtbxdtlAnswer5Value
txtbxdtlAnswer6Value
txtbxdtlAnswer7Value
txtbxdtlAnswer8Value
txtbxdtlAnswer9Value
txtbxdtlAnswer10Value

So my question is now how do I loop through recordset in my DataSet in order to fill in to these textboxes (in Telerik Reporting) ?

Heres my sample MostPreferredReport class report.

namespace EUCTVIReports   
{   
    using System;   
    using System.ComponentModel;   
    using System.Drawing;   
    using System.Windows.Forms;   
    using Telerik.Reporting;   
    using Telerik.Reporting.Drawing;   
   
    /// <summary>   
    /// Summary description for MostPreferredReport.   
    /// </summary>   
    public partial class MostPreferredReport : Telerik.Reporting.Report   
    {   
        public MostPreferredReport()   
        {   
            /// <summary>   
            /// Required for telerik Reporting designer support   
            /// </summary>   
            InitializeComponent();   
            ItemDataBinding += new System.EventHandler(MostPreferredReport_ItemDataBinding);   
        }   
   
        public DataTable Source   
        {   
            get   
            {   
                return this.Source;   
            }   
            set   
            {   
                this.DataSource = value;   
            }   
        }   
   
        void MostPreferredReport_ItemDataBinding(object sender, System.EventArgs e)   
        {   
            // SEE: http://www.telerik.com/help/reporting/faq-combine-values2.html   
   
   
            //Telerik.Reporting.Processing.DetailSection section = (Telerik.Reporting.Processing.DetailSection)sender;   
            //System.Data.DataRow row = (System.Data.DataRow)section.DataObject.RawData;   
            //if ((row["ProductName"] != null) && (row["ProductName"].ToString().Length != 0))   
            //{   
            //    Telerik.Reporting.Processing.TextBox procTextbox = (Telerik.Reporting.Processing.TextBox)section.ChildElements.Find("productNameDataTextBox", true)[0];   
            //    procTextbox.Value = row["ProductCategory"].ToString() + " " + row["ProductSubCategory"].ToString();   
            //}   
   
        }   
    }   
}  


I am appreciated your comment.

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 14 Aug 2009, 11:25 AM
Hello dewaCorp,

Your question has already been answered in the other thread you've opened. Please, see our answer there for more information.
We kindly ask you to use just one support channel to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two tickets instead of one.

Thank you for your understanding.

All the best,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dan White
Top achievements
Rank 1
answered on 25 Sep 2009, 04:01 PM
Can you link to this other thread that has the answer? It would be helpful to others of us. Thanks.

Dan
0
Steve
Telerik team
answered on 25 Sep 2009, 04:32 PM
Hi Dan,

The other thread is a support ticket and cannot be linked from forums. However we've prepared a sample runnable report demonstrating the described approach with the sample data from this post.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
DC Alliances
Top achievements
Rank 1
Answers by
Steve
Telerik team
Dan White
Top achievements
Rank 1
Share this question
or