相关疑难解决方法(0)

用于方法渲染LocalReport的线程文化

我正在将一个localreport对象用于asp.net应用程序.此报告由一组对象提供.因此,在报告的呈现中,会调用classe的一些属性.

Class ClassForReport
{
  string Date
  {
    get{return _aDate.ToshortDateString();}
  }
}
Run Code Online (Sandbox Code Playgroud)

现在渲染的代码和问题:

//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
Run Code Online (Sandbox Code Playgroud)

因此,当调用方法render时,它会启动一个线程并获取服务器的文化,而不是进程的文化.

我看到的唯一的工作方式是将我的报告更改为包含日期,然后提供文化参数,并在我的所有报告中将所有日期格式化为给定的文化...

所以我真的希望有一种方法可以告诉报告采取asp线程的复制文化,而不是采取其他一些文化来自无处.

thx提前

c# reporting-services

4
推荐指数
1
解决办法
1642
查看次数

标签 统计

c# ×1

reporting-services ×1