Page 1 of 1

DataTable Not Passing to Report Designer

Posted: Thu Oct 06, 2011 9:57 am
by bnewman
I am having problems with the Report Designer. When I pass a Datatable either by report.RegData(dTable) or myreport.Dictionary.DataStore.Add(source) the data schema comes over as you can see below:
Image
However when loading an MRT then clicking preview I get NO report Data. However when I switch everything to a Report Viewer using the same mrt to generate data I get a full report. using the following code.

Code: Select all

		string appDirectory = HttpContext.Current.Server.MapPath(string.Empty);

		StiReport report = new StiReport();
		report.Load(appDirectory + "\\App_Data\\SimpleList.mrt");

		// Load report from code
		DataTable dTable = new DataTable("Data");
		dTable.Columns.Add("col1", typeof(string));
		dTable.Columns.Add("col2", typeof(int));

		DataRow drow = dTable.NewRow();
		drow["col1"] = "test1";
		drow["col2"] = 1;
		dTable.Rows.Add(drow);
		drow = dTable.NewRow();
		drow["col1"] = "test2";
		drow["col2"] = 2;
		dTable.Rows.Add(drow);
		report.RegData(dTable);
		report.Dictionary.Synchronize();
        
		StiWebDesigner1.Design(report);

Code: Select all


        
            
            --%>
        
    


DataTable Not Passing to Report Designer

Posted: Fri Oct 07, 2011 3:18 am
by Vladimir
Hello,

Please use the GetPreviewDataSet event to register the data for preview:

Code: Select all

protected void StiWebDesigner1_GetPreviewDataSet(object sender, StiWebDesigner.StiPreviewDataSetEventArgs e)
{
    ...
    e.Report.RegData(dTable);
}
Thank you.

DataTable Not Passing to Report Designer

Posted: Tue Oct 11, 2011 10:06 am
by bnewman
That was the solution, thank you Vladimir!

DataTable Not Passing to Report Designer

Posted: Tue Oct 11, 2011 10:48 pm
by Andrew
Hello,

Great! :biggrin:

Re: DataTable Not Passing to Report Designer

Posted: Mon Jul 30, 2012 7:30 am
by patwolf
Does this mean that the data is send over to the client side multiple times?
Once for design and then again for every preview?
Would it be possible to cache it on the client side?

Thanks
Patrick

Re: DataTable Not Passing to Report Designer

Posted: Mon Jul 30, 2012 7:59 am
by HighAley
Hello.

Data isn't sent to the client side. At design-time only database tables scheme is sent to the client side.
And on preview the rendered report is sent.
The data is needed by report engine which runs on the server side.
So no data is sent to the client side at all.

Thank you.

Re: DataTable Not Passing to Report Designer

Posted: Mon Jul 30, 2012 8:08 am
by patwolf
Ah thanks for the info.
Best,
Patrick

Re: DataTable Not Passing to Report Designer

Posted: Mon Jul 30, 2012 1:28 pm
by HighAley
Hello.

You are welcome.
Ask questions else if you have.

Thank you.