2010-07-02 31 views
4

我正在使用本地报告对象到一个asp.net应用程序。 此报告由一组对象提供。因此,在报告的呈现中,类的一些属性被调用。方法的线程文化呈现LocalReport

Class ClassForReport 
{ 
    string Date 
    { 
    get{return _aDate.ToshortDateString();} 
    } 
} 

现在对于渲染代码和问题:

//first of all, I change de culture for taking in account the choice of the user 
CultureInfo ci = CultureInfo.CreateSpecificCulture(isoLanguageName_); 
Thread.CurrentThread.CurrentCulture = ci; 
Thread.CurrentThread.CurrentUICulture = ci; 
//Here, my culture is now: FR-be 

MyLocalReport.render(...) // in this method, the property Date above is called. And when debugging I see that the culture is EN !!! 

... 
//and here, my culture is still Fr-be 

如此看来,当该方法使被调用,它启动一个线程,并采取了服务器的文化,而不是文化该过程。

我看到的唯一workarround正在改变我对报告中包含日期,然后给予文化的一个参数,并在格式化我所有的时间在我的特定文化的所有报告...

所以我真的希望有一种告诉报告采取asp线程的纯文化的方式,而不是从其他文化中走出来。

提前

回答

7

THX在您ReportFile “.rdlc设计师,在语言财产 “=User!Language” 上报告设置。

<Report> 
    ... 
    <Language>=User!Language</Language> 
    ... 
</Report> 

那么你System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE"); 将在值工作在report.Render(...);像日期等。

干杯。