I am binding the report with object datasourse as shown below:
Code: Select all
StiReport report = new StiReport();
report.Load(Server.MapPath("TestReports/" + Session["FileName"].ToString()));
StiOptions.Dictionary.BusinessObjects.MaxLevel = 2;
string[] references = report.ReferencedAssemblies;
// Converting the the array to a collection
List newReferences = references.ToList();
// Add your Assembly to the list
newReferences.Add("MyProject.BusinessLib.dll");
newReferences.Add("Csla.dll");
// Reset the array of referenced assembly with the converted collection
report.ReferencedAssemblies = newReferences.ToArray();
BusinessLib.ReportCMHospAssignList rha = BusinessLib.ReportCMHospAssignList.GetReportCMHospAssignList();
report.RegData("MySource", rha);
report.Dictionary.DataSources.Clear();
report.Dictionary.Synchronize();
try
{
report.Dictionary.Connect();
report.Render();
StiReportResponse.ResponseAsPdf(this.Page, report, true);
}
catch (Exception ex)
{
ex = null;
}
'TlTerritoryList' has members ('TerId' and 'TerName'). So there is two level hierachy.
When I view this report with stimulsoft designer, then there comes two data sources (named 'MyDataSource' and 'MySource_TlTerritoryList') in the 'Dictionary' tab.
When I use any member from 'MySource', then report is rendered successfully and gives expected result.
But when I use any member of 'MySource_TlTerritoryList', then there comes following error:
Code: Select all
c:\Documents and Settings\HSS-116\aspnet~1.hss\Local Settings\Temp\zwbmx98o.0.cs(64,40) : error CS0103: The name 'MySource_TlTerritoryList' does not exist in the current context
I did lot of RnD and still stuck with this issue. Please give me the solution asap to fix the above issue.