var _rCli = new ReportServiceClient();
var dic = new NameValueDictionary();
dic.Add("ShoppingListId", 10);
NameValueDictionary dev = new NameValueDictionary();
dev.Add("OutputFormat", "JPEG");
_rCli.RenderAsync("IMAGE", "Test.ModulesReports", dev, dic);
Hi,
Im trying to pass parameter from silverlight application to my report like in code above. I definied ReportParameter at designer but its never updating to value which im passing.
thanks for any advice.
10 Answers, 1 is accepted
Currently the only way to pass value from the Silverlight client to the report which resides on the server is described in the Programmatic Initialization of Report Parameter Values in Telerik Reporting Silverlight Viewer.
All the best,
Steve
the Telerik team
So, currently this function not working? What will happened with this parameters passed to this function? Is it possible to "catch" them before report is built?
thanks
If this isn't possible, how can I have a user press a button on a silverlight web front end, and have the server render and save a report based upon the information that the user was viewing on the silverlight front end.
I suppose I must use the report viewer on my client side?
It seems that you had used the Report Parameter definition item instead of the processing counterpart. The definition report parameter value is actually the default value. However the sender of the event is always the processing counterpart of the data item and you can use it to access the processing report parameter that exposes the processing value.
Generally the report parameters are optimized for use in expressions. Still if you have to access the report parameter value in code we highly recommend to review the Using Report Parameters programmatically help article.
Peter
the Telerik team
Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.
The following code snippet illustrates how to gain the processing report report parameter's value:
private
void
Report1_NeedDataSource(
object
sender, System.EventArgs e)
{
//Take the Telerik.Reporting.Processing.Report instance
Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
var processingValue = report.Parameters[
"ManagerID"
].Value;
}
Peter
the Telerik team
Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.
As in the thread I am using below code to send report parameters
var deviceInfo = new NameValueDictionary();
//set any report parameter value if necessary
var parameters = new NameValueDictionary();
parameters.Add("AgentId", agentID);
parameters.Add("ContactCategoryID", sCategory);
parameters.Add("ContactTypeID", sType);
parameters.Add("CarrierID", carrierID);
parameters.Add("ProductID", productID);
parameters.Add("ClientID", clientID);
parameters.Add("PeriodUpto", this.PeriodUpto);
parameters.Add("MinimumCommission", this.MinCommission);
parameters.Add("SortExpression", this.SortExpression);
var serviceClient = new ReportServiceClient(new Uri(App.Current.Host.Source, "../Services/ReportService.svc"));
serviceClient.RenderAsync(format,
"AIS_InsuranceCRM_CNetWeb.ReportLibrary.Comission.CommissionPayableReport, AIS_InsuranceCRM_CNetWeb.ReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
deviceInfo,
parameters);
serviceClient.RenderCompleted += new EventHandler<
RenderEventArgs
>(serviceClient_RenderCompleted);
But in my report even if I try to look at processing report params, I do not get any value back. Please let me know how I can get the parameter values back in the report? I am not using Telerik report viewer.
Thanks
Ramessh SIngvi
You can access the parameter values with expression:
=Parameters.AgentId.Value
If you want to access the value from event:
http://www.telerik.com/help/reporting/designing-reports-parameters-programmatic-control.html
SN
I need those params to query the database and bind the data to my report. I have tried both:
private void Report_NeedDataSource(object sender, EventArgs e)
{
this.ReportParameters["AgentID"].Value
((Telerik.Reporting.Processing.Report)(sender)).Parameters["AgentID"].Value
}
but both are coming as null. Can you please put some insight on this.
Thanks
Ramessh Singvi
Your code seems correct but have in mind that the keys are case sensitive. I have noticed that once you refer the parameter as AgentID and the second time you use for key AgentId.
SN