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

Set DataSource of Table within Telerik Report at Runtime

3 Answers 749 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 20 Aug 2009, 08:43 PM
Hi,

I've been searching online for solutions that can solve my problem but most had to do with Master Details relationships.

My problem in a nutshell.

I have one Master report, the header and footer are populated with one datatable named CompanyInformation. In the details section, I have a telerik.reporting.processing.table, I set the headers and inside the table cells I drag a textbox. I set the value of the textbox to be the corresponding field from the database starting with "[=Field.something]." I bind the header and footer alright but the table will not show up at all and yes the visibility is set to true. By the way, both the master and table datasources are being set at runtime determined by a parameter passed from within an asp.net application.

heres my code.

    private void TelerikReportInvoice_NeedDataSource(object sender, EventArgs e)
        {

            int param = (int)this.ReportParameters["param "].Value;

            InvoiceDataSetTableAdapters.GetOrdersTableAdapter adapter = new TelerikReport.InvoiceDataSetTableAdapters.GetOrdersTableAdapter();
           
InvoiceDataSet.GetOrdersDataTable dt= new InvoiceDataSet.GetOrdersDataTable();
            dt= adapter.GetData(param);

            ((Telerik.Reporting.Processing.Report)sender).DataSource = dt.AsDataView();

        }

        private void table2_NeedDataSource(object sender, EventArgs e)
        {
            InvoiceDataSetTableAdapters.GetOrderFeesTableAdapter adpt = new TelerikReport.InvoiceDataSetTableAdapters.GetOrderFeesTableAdapter();

            InvoiceDataSet.GetOrderFeesDataTable dt= new InvoiceDataSet.GetOrderFeesDataTable();

            int param = (int)this.ReportParameters["param"].Value;  //same as master parameter

            dt= adpt.GetData(param);
            table2.DataSource = dt.AsDataView();

        }

I set both the table and report's datasource to be null in the constructor after initializecomponent() is called. The DataSet Visualizer also shows that there are 2 rows in the datatable returned and i'm also using stored procedures.

Thanks.


3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 24 Aug 2009, 02:20 PM
Hi Bill,

You talk about telerik.reporting.processing.table in your post, but in the NeedDataSource event you use the definition item table2 instead. Please set the DataSource to the processing table object.

Kind regards,
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
Matt
Top achievements
Rank 1
answered on 28 Feb 2012, 09:50 PM
Hi having simialar issue but my machine doesn't see AsDataView:

 

 

private void Report1_NeedDataSource(object sender, EventArgs e)

 

{

 

 

string name1 = (string)this.ReportParameters["Property"].Value;

 

 

 

string class1 = (string)this.ReportParameters["Class"].Value;

 

 

 

double duration = (double)this.ReportParameters["Duration"].Value;

 

 

 

decimal Charge = (decimal)this.ReportParameters["Charge"].Value;

 

 

 

DateTime StartDate = (DateTime)((string)this.ReportParameters["FromDate"].Value + " " + (string)this.ReportParameters["FromTime"].Value);

 

 

 

DateTime EndDate = (DateTime)((string)this.ReportParameters["ToDate"].Value + " " + (string)this.ReportParameters["ToTime"].Value);

 

 

 

string Type1 = (string)this.ReportParameters["Type"].Value;

 

HighDurChargeTableAdapters.

 

HighDurCharge_spTableAdapter adapter = new HighDurChargeTableAdapters.HighDurCharge_spTableAdapter();

 

 

 

HighDurCharge.HighDurCharge_spDataTable data1 = adapter.GetData(name1, class1, StartDate, EndDate, Type1, duration, Charge);

 

((Telerik.Reporting.Processing.

 

Report)sender).DataSource = data1.AsDataView;

 

}

Am i missing a refrence? trying to evaluate this and its not working.

thanks

matthew.majerus@xeta.com

0
Hadib Ahmabi
Top achievements
Rank 1
answered on 29 Feb 2012, 11:17 AM
It's Linq Extension method -> AsDataView(): AsDataView Method (DataTable) 
Tags
General Discussions
Asked by
Bill
Top achievements
Rank 1
Answers by
Steve
Telerik team
Matt
Top achievements
Rank 1
Hadib Ahmabi
Top achievements
Rank 1
Share this question
or