Search code examples
c#reportviewer

Interface language in reportviewer


I'm using Reportviewer to view reports in an ASP.NET MVC application. The culture of my system and browser is French. When I open the report in Visual Studio or directly from the server (in the browser) the interface is in French. But when I use reportviewer, the interface is in English. How do I get it in French?

I have tried to set the culture of the page to french like this :

(`UICulture="fr-FR"`)

or the culture of the assembly from neutral to auto like this :

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=auto`...

but without results.

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
String reportFolder = System.Configuration.ConfigurationManager.AppSettings["SSRSReportsFolder"].ToString();

rvSiteMapping.Height = Unit.Pixel(Convert.ToInt32(Request["Height"]) - 58);
rvSiteMapping.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

rvSiteMapping.ServerReport.ReportServerUrl = new Uri("http://server/PREPROD/"); 
rvSiteMapping.ServerReport.ReportPath = String.Format("/{0}/{1}", reportFolder, Request["ReportName"].ToString());

rvSiteMapping.ServerReport.Refresh();

Solution

  • I'm trying to solve this by following this post : https://devillers.nl/blog/localizing-microsoft-reportviewer/

    The idea is to implement some interfaces like this :

     public class FrenchReportViewerMessages : IReportViewerMessages, IReportViewerMessages2, IReportViewerMessages3
        {
            #region IReportViewerMessages Members
    
            // English value: Back to Parent Report
            public string BackButtonToolTip
            {
                get { return "Terug naar het vorige rapport"; }
            }
    ...
    

    And adding the folowing to my web.config:

    <add key="ReportViewerMessages" value="FrenchReportViewerMessages, MyAssembly" />
    

    That seems to be the solution, but now i get an error : The type 'FrenchReportViewerMessages, MyAssembly' could not be found