【发布时间】:2021-01-12 18:47:34
【问题描述】:
我正在开发一个 WebApplication,并在其中包含一个Telerik-Report。所描述的正常方式效果很好。
现在我正在尝试从数据库加载报告定义,而不是拥有一个文件(来自老板的请求)。到目前为止,我已经使它与一个临时文件一起工作,代码如下。但这远不是很好的编码。
我的问题:我能否以某种方式为报告提供字符串或流(而不是文件)?
我当前的代码如下所示:
private readonly string __path = "C:\\my-temp-directory\\Reports\\";
protected void Page_Load(object sender, EventArgs e) {
string contents = /** Get XML from Database **/;
File.WriteAllText(__path + "temp.trdx", contents); // <-- This file I want to omit.
if (!IsPostBack) {
this.reportViewer1.ReportSource.Identifier = "temp.trdx";
this.reportViewer1.ReportSource.IdentifierType = IdentifierType.TypeReportSource;
}
}
谢谢。
【问题讨论】:
标签: c# telerik telerik-reporting