This is a migrated thread and some comments may be shown as answers.

Pass Culture to report by a parameter

1 Answer 100 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nuno
Top achievements
Rank 1
Nuno asked on 02 Aug 2017, 04:05 PM
Hi,

I need to pass the culture by parameter to a report (TypeReportSource), in the code behind (server side).
From the report side (server side) I need to get the culture passed by report parameter to the report itself.

I tried to to do this with the following code:
Dim cultureInfo As Globalization.CultureInfo = New Globalization.CultureInfo("pt-PT")
Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo Threading.Thread.CurrentThread.CurrentCulture = cultureInfo
 This works before the 'InitializeComponent()' function as expected, but I have no way of retrieving the report parameters at this stage because they weren't initialized yet.

The main idea is to replace "pt-PT" with the report parameter sent when the report was invoked.

The following code shows how I invoke the report and pass it the required parameters:
Dim clientReportSource As New Telerik.ReportViewer.Html5.WebForms.ReportSource clientReportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.TypeReportSource clientReportSource.Identifier = "SIC.UI." & report & ", SIC.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" clientReportSource.Parameters.Add("P1", p1) clientReportSource.Parameters.Add("P2", "pt-PT") reportViewer1.ReportSource = clientReportSource reportViewer1.Page.Title = report

I'm trying to do exactly what you guys have in this demo, but so far unsuccessfully.
I've been digging through the forums and documentation for a few days now and i just can't get this to work.

Any help would be greatly appreciated.

Thanks in advance,
Nuno.

1 Answer, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 03 Aug 2017, 09:35 AM
Hello Nuno,

ReportSource.Parameters
are mapped by key to report parameters. You need to make sure that the name of the parameter matches the name of the corresponding Report Parameter.

The settings of the ProductCatalog report can be reviewed locally, this report is copied in Telerik Reporting installation folder: [installation folder]\Telerik\Reporting [version]\Examples\VB\ReportLibrary\ProductCatalog.
In this report you can see how the report's Culture property is bound to the value of report parameter (report's Bindings collection).
For more details check Bindings help article.

In case the issue persists send us the report in a support ticket so we can review its settings and provide you further suggestions.


Regards,
Katia
Progress Telerik
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
Tags
General Discussions
Asked by
Nuno
Top achievements
Rank 1
Answers by
Katia
Telerik team
Share this question
or