DataTable Not Passing to Report Designer
Posted: Thu Oct 06, 2011 9:57 am
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:

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.

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
--%>