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

Binding "Culture" from a DataSource Property

1 Answer 333 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kamesh
Top achievements
Rank 1
Kamesh asked on 08 Apr 2016, 05:17 PM

Hi,

I am evaluating Telerik Reports for our project requirements. I would like to know whether it is possible to set the Culture value of the report (en-US, es-MX, etc.) from a DataSource property. The culture information is returned as part of the data source and we are trying to build the report based on the value returned from the DB during run-time. I tried to set the Culture value in the 2 ways shown below, but both didn't work.

1) this.Bindings.Add(new Telerik.Reporting.Binding("Culture", "= SampleReport.getCulture(ReportItem.DataObject.RawData)"));

2) this.Culture = new System.Globalization.CultureInfo("= {Fields.[CultureInfo]}");

1 Answer, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 13 Apr 2016, 10:53 AM
Hello ,

Our recommendation is to add a report parameter that will store the culture information passed from the data source. You can then add the binding to the report as following:

Property path: Culture
Expression: = Parameters.Culture.Value

You can find attached a sample report demonstrating this approach. If the suggested approach is not suitable for your scenario you can open a support ticket and provide more details about it (attach a sample project together with test data).


Regards,
Katia
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
Suresh
Top achievements
Rank 1
Iron
commented on 07 Apr 2025, 10:29 PM

Hi Katia,

I tried the same culture binding in my report template. But its not working for parent control. But if I try the binding for the individual controls its working as expected. Is this expected or is there any other way to set the culture dynamically by parameter which will automatically applied to all child controls?

Dimitar
Telerik team
commented on 10 Apr 2025, 02:45 PM

Hi Suresh,

Try setting the binding on the Culture property of the Report itself. The report culture should be used by all report items that have not explicitly set another culture to be used.

For more information about culture inheritance, please visit the Globalizing Reports for Different Cultures - Telerik Reporting article.

Suresh
Top achievements
Rank 1
Iron
commented on 15 Apr 2025, 04:21 PM

Hi Dimitar,

Thanks for the answer. I was trying to set the culture property by parameter with using binding expression like this ,

But its not working as expected. But If I change the report culture manually it will work as expected. Could you please clarify this?

Dimitar
Telerik team
commented on 17 Apr 2025, 11:24 AM

Hi Suresh,

I am sorry to hear that you are experiencing issues with using this approach..

I tested it locally and the culture was successfully updated based on the value of the report parameter. For the test, I displayed a simple number with a currency formattig to see that the currency symbol will update as expected:

And this is how the binding looks in the report:

Please keep in mind that report items whose culture has been explicitly defined will not respect this binding.

In what scenario is the culture not respected in your report? When you preview it in the Standalone Report Designer or rendering the report in another application?

If it is the former, which designer do you use? The .NET Framework or .NET Standalone Report Designer?

If it is the latter, try changing the culture in the ReportsController as well, see the Localizing Report from the ReportsController - Telerik Reporting article for more details.

In case you need further assistance, please send me a copy of your report so that I can test it locally and let me know in what scenario is the culture not respected.

Tags
General Discussions
Asked by
Kamesh
Top achievements
Rank 1
Answers by
Katia
Telerik team
Share this question
or