C# LocalReport方法呈现的线程区域性
我正在asp.net应用程序中使用localreport对象。 此报表由一个对象数组提供。因此,在呈现报表时,将调用类的一些属性C# LocalReport方法呈现的线程区域性,c#,reporting-services,C#,Reporting Services,我正在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
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
因此,似乎在调用render方法时,它会启动一个线程,并采用服务器的区域性,而不是进程的区域性
我看到的唯一工作区是将我的报告更改为包含日期,然后给出区域性参数,并将所有报告中的所有日期格式化为给定区域性
因此,我真的希望有一种方法可以告诉报告采用asp线程的当前文化,而不是采用不知从何而来的其他文化
在报告文件的“.rdlc
”Designer中预先设置thx,在报告上以语言设置属性“=User!Language
”
...
=用户!语言
...
然后您的System.Threading.Thread.CurrentThread.CurrentCulture=new System.Globalization.CultureInfo(“de de”)代码>
将处理report.Render(…)中的值代码>如日期等
干杯
<Report>
...
<Language>=User!Language</Language>
...
</Report>