Dynamically set data source to designer web
Posted: Tue Oct 18, 2011 10:39 pm
Hi,
We are doing a PoC using Stimulsoft for our new project. Basically we are doing a feasibility study to finalize whether stimulsoft can be used in our project. So, I need to know whether we can set data source to Designer web dynamically. What I did was set the SqlDataSource from the code to my report before it set to the StiWebDesigner. My code looks like follows.
protected void Page_Load(object sender, EventArgs e)
{
var report = new StiReport();
var webReport = new StiWebReport();
string appDirectory = HttpContext.Current.Server.MapPath(string.Empty);
report.Load(appDirectory + "\\Reports\\ReportTemplate.mrt");
var sqlDataSource = new SqlDataSource
{
ConnectionString = @"Data Source=(local)\TEST;Initial Catalog=ABC;User ID=user;Password=user123",
SelectCommand = "SELECT [OrganizationName], [Address], [Country] FROM [Organization]"
};
webReport.RegData(report, "ReportConnection", sqlDataSource);
designer1.Design(report);
}
I can see the data source "ReportConnection" in my designer web, but data will not be showed. Appreciate your help on this.
Thanks,
Hasitha.
We are doing a PoC using Stimulsoft for our new project. Basically we are doing a feasibility study to finalize whether stimulsoft can be used in our project. So, I need to know whether we can set data source to Designer web dynamically. What I did was set the SqlDataSource from the code to my report before it set to the StiWebDesigner. My code looks like follows.
protected void Page_Load(object sender, EventArgs e)
{
var report = new StiReport();
var webReport = new StiWebReport();
string appDirectory = HttpContext.Current.Server.MapPath(string.Empty);
report.Load(appDirectory + "\\Reports\\ReportTemplate.mrt");
var sqlDataSource = new SqlDataSource
{
ConnectionString = @"Data Source=(local)\TEST;Initial Catalog=ABC;User ID=user;Password=user123",
SelectCommand = "SELECT [OrganizationName], [Address], [Country] FROM [Organization]"
};
webReport.RegData(report, "ReportConnection", sqlDataSource);
designer1.Design(report);
}
I can see the data source "ReportConnection" in my designer web, but data will not be showed. Appreciate your help on this.
Thanks,
Hasitha.