Page 1 of 1

Dynamically set data source to designer web

Posted: Tue Oct 18, 2011 10:39 pm
by hasithalk
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.

Dynamically set data source to designer web

Posted: Wed Oct 19, 2011 7:54 am
by HighAley
Hello, Hasitha.

Please, see an attached project.

Thank you.

Dynamically set data source to designer web

Posted: Thu Oct 27, 2011 6:00 am
by hasithalk
Thank you....

Dynamically set data source to designer web

Posted: Fri Oct 28, 2011 7:39 am
by Andrew
Have a great day!