This is a migrated thread and some comments may be shown as answers.
Setting Reporting Parameter from Session Variables
1 Answer 46 Views
This is a migrated thread and some comments may be shown as answers.
SwanB
Top achievements
Rank 1
SwanB asked on 29 Nov 2016, 11:39 PM
How can we most easily perform the follwoing directly from the Stanalone Report designer?

//Get the current user name from the CurrentUserName Session variable
string un = HttpContext.Current.Session["CurrentUserName"].ToString();

//Set a value to a Report Parameter1 used in a report filter
report1.ReportParameters["Parameter1"].Value = un;

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 30 Nov 2016, 12:42 PM
Hello SwanB,

The Standalone Report Designer is a desktop application. When you preview reports in it, they are processed locally in the context of the desktop application.

Once the report is designed and included in a web application, you can get the Session variable and use it as a value for the report parameter in code e.g.:
//specify the report that will be diplsayed via ReportSource - http://docs.telerik.com/reporting/report-sources
var URS = new UriReportSource();
URS.Uri = Server.MapPath("~/ReportsFolder/Report1.trdp");
 
//specify values to be passed to report parameters
//the ReportSource.Parameters collection is mapped to the report's ReportParameters collection by Name
URS.Parameters.Add("Parameter1",Session["param1"].ToString());


Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
SwanB
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or