Dynamically set data source to designer web

Stimulsoft Reports.WEB discussion
Post Reply
hasithalk
Posts: 3
Joined: Tue Oct 18, 2011 10:29 pm
Location: Sri Lanka

Dynamically set data source to designer web

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Dynamically set data source to designer web

Post by HighAley »

Hello, Hasitha.

Please, see an attached project.

Thank you.
Attachments
1370.Sample.zip
(288.4 KiB) Downloaded 419 times
hasithalk
Posts: 3
Joined: Tue Oct 18, 2011 10:29 pm
Location: Sri Lanka

Dynamically set data source to designer web

Post by hasithalk »

Thank you....
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Dynamically set data source to designer web

Post by Andrew »

Have a great day!
Post Reply