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

Binding a Report Table outside of DataBind()...

2 Answers 207 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Allen Smothers
Top achievements
Rank 2
Allen Smothers asked on 22 Apr 2011, 04:26 PM
Hello,

I'm using VS 2008 Q1 2010 Telerik Reporting

I'm attempting to set and bind a Telerik.Reporting.Processing.Table inside of the Detail's detail_ItemDataBound event and I'm running into some trouble.

I currently have a simple table inside my Report's detail. The table has a header and a detail row that repeats.

Originally I was binding the table to a DataTable inside of the DataBind() and having no issues.  After having some trouble getting the table's groupings correct I decided it would be a little more practical move the Telerik.Reporting.Processing.Table binding inside the detail_ItemDataBound event and bind it there with the correct data.  When I move the binding inside the detail_ItemDataBound event I get a blank table with no data.

Below is my code from the detail_ItemDataBound event:
private void detail_ItemDataBound(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.DetailSection detail = (Telerik.Reporting.Processing.DetailSection)sender;
    Telerik.Reporting.Processing.TextBox txtHierarchicalEntityID = (Telerik.Reporting.Processing.TextBox)detail.ChildElements.Find("txtHierarchicalEntityID", true)[0];
    Telerik.Reporting.Processing.Table tblReport = (Telerik.Reporting.Processing.Table)detail.ChildElements.Find("tblReport", true)[0];
 
    int hierarchicalEntityID = Convert.ToInt32(txtHierarchicalEntityID.Text);
 
    dsReporting dsBindingData = new dsReporting();
 
    foreach (dsReporting.AssessmentResultsChartRow currRow in dsRaw.AssessmentResultsChart.Rows)
        if ((int)currRow["HierarchicalEntityID"] == hierarchicalEntityID)
            dsBindingData.AssessmentResultsChart.ImportRow(currRow);
 
    dsBindingData.AcceptChanges();
 
    tblReport.DataSource = dsBindingData.AssessmentResultsChart;
}

Am I missing anything simple that would keep the tblReport from binding correctly?

Thanks for the help and let me know if you need anything else,
Allen

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 27 Apr 2011, 04:21 PM
Hi Allen Smothers,

The ItemDataBound event is called too late for binding data items. ItemDataBound fires just after the section is bound to data while the ItemDataBinding fires just before the section is bound to data. We will appreciate if you elaborate your scenario in detail in order to help you find the most suitable solution.

You may find useful the following help articles:

Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Allen Smothers
Top achievements
Rank 2
answered on 28 Apr 2011, 03:32 PM
Thanks Peter,

I've found a solution using SubReports.

Thanks again,
Allen
Tags
General Discussions
Asked by
Allen Smothers
Top achievements
Rank 2
Answers by
Peter
Telerik team
Allen Smothers
Top achievements
Rank 2
Share this question
or